From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Subject: Re: Emacs hangs while loading org file with python blocks Date: Tue, 6 Dec 2016 22:41:04 -0500 Message-ID: <019b6d90-65ae-afd3-fec7-da9a6b8351d3@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0mogRdOH2ENKCtaJ1C9GXP5CW1wrjX7qQ" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cET70-0007LM-WF for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 22:41:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cET6x-0006m7-1v for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 22:41:43 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:53135) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cET6w-0006eR-Mq for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 22:41:38 -0500 Received: from [18.189.106.208] ([18.189.106.208]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.168]) with ESMTPSA (Nemesis) id 0MdZVI-1c2SWd0xA4-00PMlf for ; Wed, 07 Dec 2016 04:41:15 +0100 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0mogRdOH2ENKCtaJ1C9GXP5CW1wrjX7qQ Content-Type: multipart/mixed; boundary="cXpmJASPIEqpq4u712HvhNj31tsEFBLPh"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-orgmode@gnu.org Message-ID: <019b6d90-65ae-afd3-fec7-da9a6b8351d3@gmail.com> Subject: Re: [O] Emacs hangs while loading org file with python blocks References: In-Reply-To: --cXpmJASPIEqpq4u712HvhNj31tsEFBLPh Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi David, It might be good to open a bug report on the Emacs side; a Python font-lo= cking freeze was fixed on master recently, but there may be other ones (y= our example hangs Emacs for me too), and your profile doesn't seem very O= rg-specific. The following backtrace might be useful too: Debugger entered--Lisp error: (quit) python-nav-end-of-statement() python-info-end-of-statement-p() python-info-end-of-block-p() python-nav--forward-sexp(-1 nil nil) python-nav-forward-sexp(-1 nil nil) python-nav-backward-sexp() python-info-docstring-p((0 nil 24 34 nil nil 0 nil 42 nil nil)) python-font-lock-syntactic-face-function((0 nil 24 34 nil nil 0 nil 42 = nil nil)) font-lock-fontify-syntactically-region(1 72 nil) font-lock-default-fontify-region(1 72 nil) font-lock-fontify-region(1 72 nil) font-lock-default-fontify-buffer() #[(_beg _end) =85 [font-lock-fontified font-lock-mode font-lock-default= -fontify-buffer nil] 2](1 72) org-font-lock-ensure() org-src-font-lock-fontify-block(#("python" 0 6 (fontified t)) 93 163) org-fontify-meta-lines-and-blocks-1(173) org-fontify-meta-lines-and-blocks(173) font-lock-fontify-keywords-region(1 173 nil) font-lock-default-fontify-region(1 173 nil) font-lock-fontify-region(1 173) #[=85](font-lock-fontify-region) run-hook-wrapped(#[=85] font-lock-fontify-region) jit-lock--run-functions(1 173) jit-lock-fontify-now(1 501) jit-lock-function(1) redisplay_internal\ \(C\ function\)() Cheers, Cl=E9ment. On 2016-12-06 20:41, David Dynerman wrote: > Dear list, >=20 > For several months I've been encountering a frustrating bug. My emacs h= angs while initially loading an org file with ~3000 lines and around two = dozen python blocks. If I press C-g during the lockup, emacs wakes up and= the file is loaded. The hang does not re-occur after happening on initia= l load - the bug will reoccur only if I restart emacs and load the file a= gain. The hang seems to be related to fontifying the python blocks: after= I abort with C-g, some blocks will be unfontified.=20 >=20 > I previously emailed the list about this bug (Wed, 17 Aug 2016, subject= 'Emacs hangs while loading .org file'), but didn't have an easy way to r= eproduce the problem. >=20 > I've now managed to extract a minimal org file that reproduces the hang= : >=20 > #+BEGIN_SRC python > """xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx""" > #+END_SRC > #+BEGIN_SRC python > class x: =20 > def x(self): > """ > """ > pass > #+END_SRC >=20 > To reproduce: >=20 > 1) Save above as bug.org > 2) Open a fresh emacs process, and C-x f bug.org > 3) Observe emacs is unresponsive. I've let it run as long as 30 mins wi= thout any change.=20 >=20 > I am able to reproduce with emacs -Q, only executing the following in *= scratch*: >=20 > (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/org") ;; org = from git installed here > (require 'org) >=20 > This is with the latest org code from git (release_9.0-132-gd65aa3). Th= e bug does NOT occur with org 8.2.10. I've been encountering this bug for= several months, but unfortunately I don't remember exactly when I first = saw it. >=20 > I'm running GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0, Carbon Version= 157 AppKit 1404.47) of 2016-11-24. >=20 > I'm mystified as to what's going on here. It seems that removing any of= the python code in the example above causes the bug to disappear, but I = have no clue what the problem might be. >=20 > I've attached a profiler report captured during the hang. Here is the r= elevant part: >=20 > - org-src-font-lock-fontify-block 17419 = 46% > - org-font-lock-ensure 17240 = 45% > - # 17240 = 45% > - font-lock-default-fontify-buffer 17240 = 45% > - font-lock-fontify-region 17240 = 45% > - font-lock-default-fontify-region 17240 = 45% > - font-lock-fontify-syntactically-region = 17240 45% > - python-font-lock-syntactic-face-function = 17240 45% > - python-info-docstring-p 17240 = 45% > - python-nav-backward-sexp 17240 = 45% > - python-nav-forward-sexp 17240 = 45% > - python-nav--forward-sexp 17240 = 45% > - python-info-end-of-block-p 17240 = 45% > - python-info-end-of-statement-p 1= 7240 45% > - python-nav-end-of-statement 154= 44 41% > syntax-ppss 8641 = 22% >=20 > It looks like emacs is getting stuck navigating the python blocks durin= g fontification. The last org-mode call appears to be (org-font-lock-ensu= re). >=20 > If anyone has any suggestions on how to fix this, I'd be very intereste= d to hearthem - I'm working with larger and larger org files containing p= ython code, so I'm encountering this bug frequently. >=20 > Thank you very much, > David >=20 --cXpmJASPIEqpq4u712HvhNj31tsEFBLPh-- --0mogRdOH2ENKCtaJ1C9GXP5CW1wrjX7qQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYR4TZAAoJEPqg+cTm90wjxUcP/AiapdJBPOzJc3QewgZJ92sU duI2J8uVWzz5TTVbSAcjmpRF5Sq40b8Hmh2FLVrcipHnmmc5lD2YH26V/2ceQ725 6zlos4nt/QBrh2iZF6upjR8nSHumtI3KY+xj7D5iH6ypdoO4qfYMuQheSE4ve924 wX3ACm91BVeTR/4+KtaVen0Wcczzke9UuNdOZ1ocFdTjSbsMV71sYK0Jrx8IvYid sBRupgVs6DZTtbULiefTMY5DySwRWShqBjVeXEkGnItBJFsf74dHPaw+AXhT6JhE wWU2BL8L9TFfh8+47rDoJUxeb9wyV+/v6hd9fWEFMcLE3nxAMp93AX9MhI3uRUtB GuiLmOFaCntomUNN2wWjEa5RfHAfI3RjMYTf+QIM8ocltU+5+sCnor+VM0BWd2+O Xii2ruOb9nlH8CDWoo/i7sA9+QGJbAYKemvIycNkzElUJ81bjka9JgmjHVUG2WCh rhcQnVWMeSxIY7xt/NGBSer859awNynG6NNpUJ3Y16KB8nVj/01A16Mq5IpFqxkc pxSbUgLTsR1IH1ImMZurPvLTlR3vXQ/4OANEpWc8IqnYlwsfSDJtFOkrbxhx4IJF CtUgHbuJg7gMuT4YJM1isihzEot/C7wt0fCoGP1FWcacDGTTfV474cumxq1XkRap oFdGgeF0e7wJvMvXb86T =vvgg -----END PGP SIGNATURE----- --0mogRdOH2ENKCtaJ1C9GXP5CW1wrjX7qQ--