From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#40907: Font-lock-mode hanging in Java buffers Date: Wed, 29 Apr 2020 18:36:37 +0000 Message-ID: <20200429183637.GA10680@ACM> References: <215d8224-219b-ad06-ba4a-f99250e0a56d@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="75177"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40907@debbugs.gnu.org, Dmitry Gutov To: Adam Van Ymeren Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 29 20:37:21 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTraC-000JS6-AD for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Apr 2020 20:37:20 +0200 Original-Received: from localhost ([::1]:50700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTraB-00082B-BB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Apr 2020 14:37:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37264) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTrZv-0007yJ-N5 for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 14:37:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTrZu-0003Ov-8I for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 14:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jTrZt-0003Oq-SW for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 14:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jTrZt-0003YO-PV for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 14:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Apr 2020 18:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40907 X-GNU-PR-Package: emacs Original-Received: via spool by 40907-submit@debbugs.gnu.org id=B40907.158818540413632 (code B ref 40907); Wed, 29 Apr 2020 18:37:01 +0000 Original-Received: (at 40907) by debbugs.gnu.org; 29 Apr 2020 18:36:44 +0000 Original-Received: from localhost ([127.0.0.1]:44570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTrZb-0003Xn-PY for submit@debbugs.gnu.org; Wed, 29 Apr 2020 14:36:44 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:59103 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jTrZY-0003XX-9K for 40907@debbugs.gnu.org; Wed, 29 Apr 2020 14:36:41 -0400 Original-Received: (qmail 56104 invoked by uid 3782); 29 Apr 2020 18:36:38 -0000 Original-Received: from acm.muc.de (p4FE15DE7.dip0.t-ipconnect.de [79.225.93.231]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Wed, 29 Apr 2020 20:36:37 +0200 Original-Received: (qmail 10754 invoked by uid 1000); 29 Apr 2020 18:36:37 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179343 Archived-At: Hello, Adam. On Mon, Apr 27, 2020 at 18:21:09 +0000, Adam Van Ymeren wrote: > On 2020-04-27 5:38 p.m., Dmitry Gutov wrote: > > On 27.04.2020 20:30, Adam Van Ymeren wrote: > >> I've been doing a lot of Java work lately, and I'm having issues with > >> emacs hanging and spinning at 100% CPU.  I believe the culprit to be > >> font-lock-mode.  C-g doesn't save me either, I usually have to kill > >> emacs.  Any advice on how to debug this if C-g doesn't work? > > You can send the USR2 signal to the Emacs process to try to interrupt > > what it's doing and enter the debugger: > > kill -SIGUSR2 > > To fix this, we'll most likely need the contents of the buffer that > > has the problem. If it's proprietary, you could try recreating the > > problem from scratch, or replacing all identifiers in the code with > > something else, etc. > > You could also try a build of Emacs 27 first before doing all that. > Wow SIGUSR2 is magical, thanks for that tip.  I reproduced it once > visiting a particular file but it's not happening reliably for me now.  > Below is the stacktrace and the contents of the associated buffer, but > it's not reproducing reliably.  Now that I know about SIGUSR2 I'll > report back with a reliable repro once I figure one out. The buffer copy you sent looks corrupted - it contains lots of non-breaking spaces (or are these intended?) and it seems to be double-spaced all the way through. If it is corrupted, is there any chance you could post a clean version, possibly by attaching it to your email? With that, there's a good chance your stack trace will be enough to be able to debug this. There's also a good chance the bug has already been diagnosed and fixed (for the upcoming Emacs-27.1), but it will need some effort to verify this. > Here's the emacs stacktrace: [ Double spacing removed from this ... ] > Debugger entered--entering a function: > * #f(compiled-function () #)() >   c-parse-state() >   c-syntactic-skip-backward("^;{}" 5344 t) >   c-fl-decl-start(5927) >   c-context-expand-fl-region(5927 6427) >   #f(compiled-function (fn) #)(c-context-expand-fl-region) >   mapc(#f(compiled-function (fn) #) (c-context-expand-fl-region)) >   c-before-context-fl-expand-region(5927 6427) >   c-font-lock-fontify-region(5927 6427 nil) >   font-lock-fontify-region(5927 6427) >   #f(compiled-function (fun) #)(font-lock-fontify-region) >   run-hook-wrapped(#f(compiled-function (fun) #) font-lock-fontify-region) >   jit-lock--run-functions(5927 6427) >   jit-lock-fontify-now(5927 6427) >   jit-lock-function(5927) >   redisplay_internal\ \(C\ function\)() > And the buffer contents are given after ==== > =============== > /** >  * @license >  * Copyright 2017 The FOAM Authors. All Rights Reserved. >  * http://www.apache.org/licenses/LICENSE-2.0 >  */ > package foam.dao; > import foam.core.*; > import foam.dao.index.*; [ .... ] -- Alan Mackenzie (Nuremberg, Germany).