unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Copley <rcopley@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25279@debbugs.gnu.org
Subject: bug#25279: 26.0.50; Slowdown/crash on certain characters
Date: Mon, 26 Dec 2016 21:21:57 +0000	[thread overview]
Message-ID: <CAPM58ohq=_YMqPJuD3+WqtVfrCOO=RGNVY_cGtjUOM0n-Co7=g@mail.gmail.com> (raw)
In-Reply-To: <83tw9qwh4z.fsf@gnu.org>

On 26 December 2016 at 20:49, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Richard Copley <rcopley@gmail.com>
>> Date: Mon, 26 Dec 2016 20:40:42 +0000
>> Cc: 25279@debbugs.gnu.org
>>
>> > Because you don't have Symbola installed, I guess.  The fonts Emacs
>> > finds for displaying these characters all have non-Unicode registry
>> > fields, and that causes Emacs to desperately look for a Unicode font
>> > each time it needs to display one of these characters.
>>
>> OK, thanks, but I don't quite follow, sorry. Unless you're saying there's a
>> non-desperate mechanism that's usually used but which fails unless a
>> font with a Unicode registry field is found for the character?
>
> When Emacs doesn't find a font with a Unicode registry, it looks in
> many fonts trying many alternative registries.  Each font is tried
> twice, ones with the Uniscribe back-end, the other one with the GDI
> back-end.  All of that does a lot of consing, so the next GC comes
> soon, and compacts font caches by deleting all that information.  Then
> the next time redisplay kicks in, it searches all of those fonts
> again, and again conses a lot, which again causes GC.  Etc. etc.
>
>> Commendably thorough, but causes the editor to grind to a halt and crash
>> in some circumstances.
>
> A crash shouldn't happen in any case, so if you can show a recipe and
> a backtrace, maybe this could be fixed.
>
> Thanks.

Reproducing the slowness and high CPU consumption is easy.

The "crash" I referred to is probably better termed a "hang" (as
far as I can see an indefinite one), sorry. I don't know a simple
recipe, but if you use Emacs in this state for long enough, it
usually hangs eventually.

Recipe:
Uninstall Symbola (but perhaps other font changes are required).
Run emacs -Q.

M-x insert-char RET MUSIC SPC FLAT SPC SIGN RET
M-x insert-char RET RIGHTWARDS SPC DOUBLE SPC ARROW RET
C-b ;; place point before the arrow
M-x describe-char RET ;; display a few more arrows

Move point around the scratch buffer and observe that moving
past the FLAT character is slow.
Switch to the describe-char buffer and observe that moving
point past the FLAT character is slow, and scrolling is slow.

Keep doing stuff in that Emacs session until it hangs and stops
responding. This can take some time and might never happen,
but there doesn't seem to be any particular "stuff" that triggers
it. Switching away to a different task for a few minutes and back
again sometimes does it.

Below are C call stacks obtained from a hung emacs process
by attaching gdb to it.

Possibly a clue:
While I had the hung emacs process stopped in GDB I started a
new Emacs process to edit this email and the new Emacs was
also horribly slow! When I killed the process in the debugger,
the new Emacs recovered to normal speed.

(gdb) thread apply all bt full

Thread 6 (Thread 8808.0x304):
#0  0x00007ffc3eb69921 in ntdll!DbgBreakPoint () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#1  0x00007ffc3eb919ba in ntdll!DbgUiRemoteBreakin () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#2  0x00007ffc3c038364 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#3  0x00007ffc3eb270d1 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#4  0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 5 (Thread 8808.0x20):
#0  0x00007ffc3eb698a4 in ntdll!ZwWaitForWorkViaWorkerFactory () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#1  0x00007ffc3eaf352e in ntdll!RtlReleaseSRWLockExclusive () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#2  0x00007ffc3c038364 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#3  0x00007ffc3eb270d1 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#4  0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 4 (Thread 8808.0xe2c):
#0  0x00007ffc3eb698a4 in ntdll!ZwWaitForWorkViaWorkerFactory () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#1  0x00007ffc3eaf352e in ntdll!RtlReleaseSRWLockExclusive () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#2  0x00007ffc3c038364 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#3  0x00007ffc3eb270d1 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#4  0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 3 (Thread 8808.0x2bfc):
#0  0x00007ffc3eb69844 in ntdll!ZwWaitForAlertByThreadId () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#1  0x00007ffc3eaefa87 in ntdll!RtlpUnWaitCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#2  0x00007ffc3eaef98e in ntdll!RtlpUnWaitCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#3  0x00007ffc3eaef81f in ntdll!RtlpUnWaitCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#4  0x00007ffc3eaf0ce4 in ntdll!RtlEnterCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#5  0x00007ffc3eaf0c10 in ntdll!RtlEnterCriticalSection () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#6  0x0000000400216a9b in post_msg ()
No symbol table info available.
#7  0x00000004001f1920 in post_character_message ()
No symbol table info available.
#8  0x00000004001fc2b6 in w32_wnd_proc ()
No symbol table info available.
#9  0x00007ffc3dbe1c24 in USER32!CallWindowProcW () from
C:\WINDOWS\System32\user32.dll
No symbol table info available.
#10 0x00007ffc3dbe156c in USER32!DispatchMessageW () from
C:\WINDOWS\System32\user32.dll
No symbol table info available.
#11 0x00000004001f9dc3 in w32_msg_pump.isra ()
No symbol table info available.
#12 0x00000004001fa430 in w32_msg_worker ()
No symbol table info available.
#13 0x00007ffc3c038364 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#14 0x00007ffc3eb270d1 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#15 0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 8808.0x2860):
#0  0x00007ffc3eb66754 in ntdll!ZwDelayExecution () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#1  0x00007ffc3bb6c4a7 in SleepEx () from C:\WINDOWS\System32\KernelBase.dll
No symbol table info available.
#2  0x000000040022fad9 in timer_loop ()
No symbol table info available.
#3  0x00007ffc3c038364 in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#4  0x00007ffc3eb270d1 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#5  0x0000000000000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 8808.0x2cf8):
#0  0x00007ffc3c0196a4 in win32u!NtUserSetMenu () from
C:\WINDOWS\System32\win32u.dll
No symbol table info available.
#1  0x00000004002031ad in set_frame_menubar ()
No symbol table info available.
#2  0x00000004000229c0 in update_menu_bar.part ()
No symbol table info available.
#3  0x0000000400051e21 in redisplay_internal ()
No symbol table info available.
#4  0x0000000400054de5 in redisplay_preserve_echo_area ()
No symbol table info available.
#5  0x000000040000cf52 in sit_for ()
No symbol table info available.
#6  0x00000004000f31c9 in command_loop_1 ()
No symbol table info available.
#7  0x0000000400175809 in internal_condition_case ()
No symbol table info available.
#8  0x00000004000e1614 in command_loop_2 ()
No symbol table info available.
#9  0x00000004001756f7 in internal_catch ()
No symbol table info available.
#10 0x00000004000e14f3 in command_loop ()
No symbol table info available.
#11 0x00000004000e8f94 in recursive_edit_1 ()
No symbol table info available.
#12 0x000000040011c221 in read_minibuf ()
No symbol table info available.
#13 0x000000040011cbad in Fread_from_minibuffer ()
No symbol table info available.
#14 0x0000000400177c04 in Ffuncall ()
No symbol table info available.
#15 0x00000004001c3e56 in exec_byte_code ()
No symbol table info available.
#16 0x000000040017747d in funcall_lambda ()
No symbol table info available.
#17 0x00000004001778a1 in Ffuncall ()
No symbol table info available.
#18 0x000000040011ac19 in Fcompleting_read ()
No symbol table info available.
#19 0x0000000400177cf1 in Ffuncall ()
No symbol table info available.
#20 0x00000004001c3e56 in exec_byte_code ()
No symbol table info available.
#21 0x000000040017747d in funcall_lambda ()
No symbol table info available.
#22 0x00000004001778a1 in Ffuncall ()
No symbol table info available.
#23 0x00000004001c3e56 in exec_byte_code ()
No symbol table info available.
#24 0x00000004001c68be in Fbyte_code ()
No symbol table info available.
#25 0x0000000400176b42 in eval_sub ()
No symbol table info available.
#26 0x000000040017c96b in Feval ()
No symbol table info available.
#27 0x0000000400172dca in Fcall_interactively ()
No symbol table info available.
#28 0x0000000400177c89 in Ffuncall ()
No symbol table info available.
#29 0x00000004001c3e56 in exec_byte_code ()
No symbol table info available.
#30 0x000000040017747d in funcall_lambda ()
No symbol table info available.
#31 0x00000004001778a1 in Ffuncall ()
No symbol table info available.
#32 0x0000000400177d8d in call1 ()
No symbol table info available.
#33 0x00000004000f291f in command_loop_1 ()
No symbol table info available.
#34 0x0000000400175809 in internal_condition_case ()
No symbol table info available.
#35 0x00000004000e1614 in command_loop_2 ()
No symbol table info available.
#36 0x00000004001756f7 in internal_catch ()
No symbol table info available.
#37 0x00000004000e15c9 in command_loop ()
No symbol table info available.
#38 0x00000004000e62c4 in Frecursive_edit ()
No symbol table info available.
#39 0x000000040026e699 in main ()
No symbol table info available.





  reply	other threads:[~2016-12-26 21:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 20:09 bug#25279: 26.0.50; Slowdown/crash on certain characters Richard Copley
2016-12-26 20:18 ` Richard Copley
2016-12-26 20:25 ` Eli Zaretskii
2016-12-26 20:40   ` Richard Copley
2016-12-26 20:49     ` Eli Zaretskii
2016-12-26 21:21       ` Richard Copley [this message]
2016-12-27  7:21         ` Eli Zaretskii
     [not found]           ` <CAPM58oiS8+TuR8WhKZmEZdWY_ac44xLDjnpYAD0aWqU6=mX7eg@mail.gmail.com>
2016-12-27 13:51             ` bug#25279: Fwd: " Richard Copley
     [not found]             ` <CAPM58oioMPAo=x8F1whs5YS3RMwceoadAT9TN7Macbx=SaxyJA@mail.gmail.com>
2016-12-27 13:53               ` Richard Copley
     [not found]               ` <838tr1wlg4.fsf@gnu.org>
     [not found]                 ` <CAPM58og6d1EqTEyMy6df27DXB_ERYOD5=pmFHC9MmoFmq+CDgw@mail.gmail.com>
     [not found]                   ` <837f6lwkju.fsf@gnu.org>
2016-12-27 14:06                     ` Richard Copley
2016-12-27 14:15                       ` Eli Zaretskii
2016-12-27 14:32                         ` Richard Copley
2016-12-27 21:15                           ` Richard Copley
2017-02-21 20:05                             ` Richard Copley
2017-02-21 20:28                               ` Eli Zaretskii
2017-02-21 20:33                                 ` Richard Copley
2017-02-21 20:38                                   ` Richard Copley
2017-02-23 16:19                                 ` Eli Zaretskii
2017-02-23 19:15                                   ` Richard Copley
2017-02-23 19:20                                     ` Richard Copley
2017-02-23 15:22                               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPM58ohq=_YMqPJuD3+WqtVfrCOO=RGNVY_cGtjUOM0n-Co7=g@mail.gmail.com' \
    --to=rcopley@gmail.com \
    --cc=25279@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).