GNU bug report logs - #32351
assq_no_quit: circular loop (default, line-number, line-number-current-line)

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Fri, 3 Aug 2018 02:11:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32351 in the body.
You can then email your comments to 32351 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Fri, 03 Aug 2018 02:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keith David Bershatsky <esq <at> lawlist.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 03 Aug 2018 02:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Emacs Bug Reports <bug-gnu-emacs <at> gnu.org>
Subject: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Thu, 02 Aug 2018 19:10:12 -0700
I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.

(line-number-current-line . [face unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified line-number unspecified unspecified])

(line-number . [face unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified unspecified (shadow default) unspecified unspecified])

(default . [face "Courier" "nil" normal 180 normal normal nil nil "white" "black" nil nil nil nil #<font-object "-*-Courier-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1"> nil "-*-Courier-normal-normal-normal-*-18-*-*-*-m-0-fontset-auto1" unspecified]))

If I start/stop Emacs with the gdb, the KEY to assq_no_quit oscillates from the above three (3) faces.  Any ideas why this is a never ending loop?

The source code line numbers will be off because this is my working copy for developing feature requests (crosshairs/multiple-fake-cursors).  According to the gdb printout, my custom modifications are not at issue here.  Maybe it has something do with "font-object" in the default face above?

Program received signal SIGTSTP, Stopped (user).
0x0000000100216c51 in assq_no_quit (key=XIL(0x7c80), list=XIL(0x11b813b63))
    at fns.c:1487
1487	  for (; ! NILP (list); list = XCDR (list))
(gdb) bt
#0  0x0000000100216c51 in assq_no_quit (key=XIL(0x7c80), list=XIL(0x11b813b63))
    at fns.c:1487
#1  0x000000010012c656 in lface_from_face_name_no_resolve (f=0x10308cbb0, 
    face_name=XIL(0x7c80), signal_p=false) at xfaces.c:1860
#2  0x000000010012c74f in get_lface_attributes_no_remap (f=0x10308cbb0, 
    face_name=XIL(0x7c80), attrs=0x7fff5fbebb30, signal_p=false)
    at xfaces.c:1902
#3  0x000000010012c956 in get_lface_attributes (w=0x10309da30, f=0x10308cbb0, 
    face_name=XIL(0x7c80), attrs=0x7fff5fbebb30, signal_p=false, 
    named_merge_points=0x7fff5fbebbd0) at xfaces.c:1952
#4  0x000000010012d3c9 in merge_named_face (w=0x10309da30, f=0x10308cbb0, 
    face_name=XIL(0x7c80), to=0x7fff5fbebc30, named_merge_points=0x7fff5fbebbd0)
    at xfaces.c:2178
#5  0x0000000100138b28 in merge_faces (w=0x10309da30, face_name=XIL(0x7c80), 
    face_id=0, base_face_id=0) at xfaces.c:6352
#6  0x000000010007a8ba in maybe_produce_line_number (it=0x7fff5fbf5880)
    at xdisp.c:23690
#7  0x000000010005067f in move_it_in_display_line_to (it=0x7fff5fbf5880, 
    to_charpos=11104, to_x=-1, op=MOVE_TO_POS) at xdisp.c:11166
#8  0x00000001000546c4 in move_it_to (it=0x7fff5fbf5880, to_charpos=11104, 
    to_x=-1, to_y=-1, to_vpos=-1, op=8) at xdisp.c:11976
#9  0x00000001000550b4 in move_it_vertically_backward (it=0x7fff5fbf80d0, 
    dy=962) at xdisp.c:12170
#10 0x000000010006ba00 in redisplay_window (window=XIL(0x10309da35), 
    just_this_one_p=false) at xdisp.c:19855
#11 0x0000000100062ba3 in redisplay_window_0 (window=XIL(0x10309da35))
    at xdisp.c:17440
#12 0x0000000100208b85 in internal_condition_case_1 (
    bfun=0x100062b64 <redisplay_window_0>, arg=XIL(0x10309da35), 
    handlers=XIL(0x10181fe43), hfun=0x100062b2c <redisplay_window_error>)
    at eval.c:1373
#13 0x0000000100062b02 in redisplay_windows (window=XIL(0x10309da35))
    at xdisp.c:17420
#14 0x0000000100062abd in redisplay_windows (window=XIL(0x11d4d4d15))
    at xdisp.c:17414
#15 0x00000001000614ba in redisplay_internal () at xdisp.c:16889
#16 0x000000010005b887 in echo_area_display (update_frame_p=true)
    at xdisp.c:14107
* * *




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Fri, 03 Aug 2018 06:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Fri, 03 Aug 2018 09:45:37 +0300
> Date: Thu, 02 Aug 2018 19:10:12 -0700
> From: Keith David Bershatsky <esq <at> lawlist.com>
> 
> I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.

Where does the error message cited in the subject come from?  It
doesn't come from assq_no_quit, does it?

Also, your line numbers don't match the current master (fns.c:1487 is
not in assq_no_quit), so I cannot be sure what local changes do you
have that are involved.

And finally, yes, a recipe which at least states what are the
customizations required to reproduce would be nice.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Fri, 03 Aug 2018 15:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Fri, 03 Aug 2018 08:17:30 -0700
Thank you, Eli, for looking at issue #32351.

There is no error message, just a never-ending loop.  Source code line numbers in fns.c match up with 07/07/2018 master branch bearing commit 98463bed07ecc9057094928ffdc2321eaaf3ab52.  This is my working build with feature requests (crosshairs and multiple fake cursors).  No reversions have been made to fns.c.

The general circumstances with a full configuration are as follows:

1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.

2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]

3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.

4.  assq_no_quit goes into a forever never-ending loop.

5.  C-z in the terminal to break with gdb.

6.  Step:  while (CONSP (list)

7.  Step:  list = XCDR (list);

8.  Repeat stepping to infinity; e.g., step 500 yields the same results as paragraph 6/7 above.

I can reproduce this on my end every time, so if there is anything you would like to see with gdb, I'd be happy to print.  However, I may need some guidance regarding how to do it, since I just know the basics such as pp OBJECT, print, step and so forth.  I anticipate having some time in the evenings over the weekend and can work on trying to come up with an Emacs -Q recipe.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-02-2018 23:45:37] <03 Aug 2018 09:45:37 +0300>
> From: Eli Zaretskii <eliz <at> gnu.org>
> To: Keith David Bershatsky <esq <at> lawlist.com>
> CC: 32351 <at> debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> > Date: Thu, 02 Aug 2018 19:10:12 -0700
> > From: Keith David Bershatsky <esq <at> lawlist.com>
> >
> > I apologize in advance for "not yet" having a concise recipe from Emacs -Q.  I can work on creating a recipe in the coming days/weeks/months.  I am able to produce this reliably in Emacs master branch, using a full user configuration.  Here are the relevant lines from LIST to the assq_no_quit function.
> 
> Where does the error message cited in the subject come from?  It
> doesn't come from assq_no_quit, does it?
> 
> Also, your line numbers don't match the current master (fns.c:1487 is
> not in assq_no_quit), so I cannot be sure what local changes do you
> have that are involved.
> 
> And finally, yes, a recipe which at least states what are the
> customizations required to reproduce would be nice.
> 
> Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Fri, 03 Aug 2018 17:55:01 GMT) Full text and rfc822 format available.

Message #14 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Fri, 03 Aug 2018 20:54:37 +0300
> Date:  Fri, 03 Aug 2018 08:17:30 -0700
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  32351 <at> debbugs.gnu.org
> 
> 1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.
> 
> 2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]
> 
> 3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.
> 
> 4.  assq_no_quit goes into a forever never-ending loop.

Are you saying that this happens when the window is too narrow to show
the line numbers?  If so, what solution would you like to have? refuse
to display the line numbers?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Sun, 05 Aug 2018 03:27:02 GMT) Full text and rfc822 format available.

Message #17 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Sat, 04 Aug 2018 20:26:33 -0700
Yes, refusing to display the line numbers seems like a good choice to avoid a never-ending infinite loop.

At the outset of maybe_produce_line_number, I added the following code:

  int text_area_width = window_box_width (it->w, TEXT_AREA);
  if (!NILP (Vdisplay_line_numbers)
      && text_area_width < it->lnum_pixel_width)
    return;

It does not necessarily have to be that code exactly, but something along those lines would suffice.

And, the never-ending loop is now gone when using the above modification.  Due to my inexperience with gdb, I erroneously assumed that assq_no_quit or the function calling it was to blame.  However, pressing C-z to break with gdb simply ended up on assq_no_quit by the laws of probability because the LIST takes more time to process than everything else in the redisplay of the target window loop.  By setting up a break in maybe_produce_line_numbers and other functions, I was able to see that the loop is caused by trying/retrying to display the window containing line numbers.

With the above code, redisplay finishes successfully and I can see that just one (1) column of text is visible in the tall/thin sliver of a window.  And, the above code of course disables line numbers in this situation.

If it is not too much trouble, would it be possible for you to please teach me how to print a human-readable int with gdb such as text_area_width.  I ended up with:

(gdb) print text_area_width 
$1 = 1606380704

To see a human-readable value, I turned it into a Lisp Object and used pp OBJECT.  It would be nice to print int values from gdb and see human readable values without modifying the code to turn the int it into a Lisp Object prior thereto.

Thanks,

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-03-2018 10:54:37] <03 Aug 2018 20:54:37 +0300>
> From: Eli Zaretskii <eliz <at> gnu.org>
> To: Keith David Bershatsky <esq <at> lawlist.com>
> CC: 32351 <at> debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> > Date:  Fri, 03 Aug 2018 08:17:30 -0700
> > From:  Keith David Bershatsky <esq <at> lawlist.com>
> > Cc:  32351 <at> debbugs.gnu.org
> >
> > 1.  Original single window in a GUI frame with native line numbers and truncate-lines non-nil.
> >
> > 2.  Try to create/display a new window to the right that takes up approximately 95 percent of the overall frame; e.g., my custom 12 month rotating calendar.  [A workaround would be "well, if it hurts, then don't do that".  However, it would be nice to come up with a programmatic solution to avoid a never-ending loop.]
> >
> > 3.  Emacs tries to display line numbers on the little sliver of a tall/razor-thin window.  However, redisplay never finishes so the new window is not yet displayed and all that is visible to the naked eye is the full-size original window.
> >
> > 4.  assq_no_quit goes into a forever never-ending loop.
> 
> Are you saying that this happens when the window is too narrow to show
> the line numbers?  If so, what solution would you like to have? refuse
> to display the line numbers?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Mon, 13 Aug 2018 01:37:01 GMT) Full text and rfc822 format available.

Message #20 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Sun, 12 Aug 2018 18:36:02 -0700
The preceding post to issue #32351 contains a proposed solution, which appears to resolve the issue.

Here is the Emacs -Q recipe (to create the infinite redisplay loop) for both Emacs master branch and also Emacs 26.  Tested on Emacs GUI versions built --with-ns.

(let ((buffer-one (get-buffer-create "*ONE*"))
      (buffer-two (get-buffer-create "*TWO*"))
      (alist (list (cons 'window-width (- (window-width) 5))))
      (window (split-window (selected-window) nil 'right)))
    (with-current-buffer buffer-one
      (set (make-local-variable 'truncate-partial-width-windows) nil)
      (dotimes (i 200)
        (insert-char 9786 10)
        (insert-char 10 1))
      (setq display-line-numbers t))
    (with-current-buffer buffer-two
      (dotimes (i 200)
        (insert-char 9786 80)
        (insert-char 10 1)))
    (set-window-buffer (selected-window) buffer-one)
    (window--display-buffer buffer-two window 'window alist nil))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Tue, 28 Aug 2018 11:13:02 GMT) Full text and rfc822 format available.

Message #23 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Tue, 28 Aug 2018 14:12:31 +0300
> Date:  Sun, 12 Aug 2018 18:36:02 -0700
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  32351 <at> debbugs.gnu.org
> 
> The preceding post to issue #32351 contains a proposed solution, which appears to resolve the issue.
> 
> Here is the Emacs -Q recipe (to create the infinite redisplay loop) for both Emacs master branch and also Emacs 26.  Tested on Emacs GUI versions built --with-ns.

Thanks, should be fixed now on the emacs-26 branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32351; Package emacs. (Tue, 28 Aug 2018 18:47:02 GMT) Full text and rfc822 format available.

Message #26 received at 32351 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32351 <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Tue, 28 Aug 2018 11:46:24 -0700
The test case for Emacs -q (mentioned in Message #20 of this thread) now succeeds without entering an infinite loop on Emacs 26 built --with-ns.  Good job!

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [08-28-2018 04:12:31] <28 Aug 2018 14:12:31 +0300>
> From: Eli Zaretskii <eliz <at> gnu.org>
> To: Keith David Bershatsky <esq <at> lawlist.com>
> CC: 32351 <at> debbugs.gnu.org
> Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number, line-number-current-line)
> 
> 
> Thanks, should be fixed now on the emacs-26 branch.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 28 Aug 2018 19:20:02 GMT) Full text and rfc822 format available.

Notification sent to Keith David Bershatsky <esq <at> lawlist.com>:
bug acknowledged by developer. (Tue, 28 Aug 2018 19:20:02 GMT) Full text and rfc822 format available.

Message #31 received at 32351-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 32351-done <at> debbugs.gnu.org
Subject: Re: bug#32351: assq_no_quit: circular loop (default, line-number,
 line-number-current-line)
Date: Tue, 28 Aug 2018 22:19:19 +0300
> Date:  Tue, 28 Aug 2018 11:46:24 -0700
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  32351 <at> debbugs.gnu.org
> 
> The test case for Emacs -q (mentioned in Message #20 of this thread) now succeeds without entering an infinite loop on Emacs 26 built --with-ns.  Good job!

Thanks for testing, I'm therefore closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Sep 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 266 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.