Subject: bug#18785: 24.4.1; Emacs hangs with Org mode when point is in LOGBOOK

From: Fabrice Niessen <[email-masked]>
Date: Thu, 23 Oct 2014 12:34:01 +0200

Eli Zaretskii wrote:
>> From: Fabrice Niessen <[email-masked]>
>> Cc: [email-masked], Org-mode List <[email-masked]>
>> Date: Wed, 22 Oct 2014 12:35:30 +0200
>> 
>> I reproduced the problem.
>> 
>> Then, I tried (multiple times) to C-z in the GDB session, but nothing
>> happens: Emacs stays block and I don't get any GDB prompt.
>> 
>> Am I missing something?
>
> The C-z trick doesn't work on Windows.

That may be worth to mention it in the document?

> So instead run Emacs normally, reproduce the problem, and then attach
> the debugger to the running Emacs with "gdb -p PID", where PID is the
> numerical process ID of Emacs.  Then switch to thread 1, and do what
> etc/DEBUG says about "finish".

OK. Just did it.

--8<---------------cut here---------------start------------->8---
$ gdb -p 2888
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
/cygdrive/d/Users/fni/.gdbinit:19: Error in sourced command file:
No symbol table is loaded.  Use the "file" command.
Attaching to process 2888
[New Thread 2888.0x233c]
[New Thread 2888.0x2894]
[New Thread 2888.0x31a4]
[New Thread 2888.0x1d60]
[New Thread 2888.0x35c]
[New Thread 2888.0x1e2c]
[New Thread 2888.0x1cc8]
[New Thread 2888.0x1f6c]
[New Thread 2888.0x1a54]
[New Thread 2888.0x1cd4]
[New Thread 2888.0x2388]
[New Thread 2888.0x2930]
[New Thread 2888.0x664]
[New Thread 2888.0x1b70]
[New Thread 2888.0x2578]
[New Thread 2888.0x133c]
[New Thread 2888.0x18d8]
[New Thread 2888.0x1328]
[New Thread 2888.0x3110]
[New Thread 2888.0x2768]
[New Thread 2888.0x8d0]
[New Thread 2888.0x2b60]
[New Thread 2888.0x21b4]
[New Thread 2888.0x424]
[New Thread 2888.0x3068]
[New Thread 2888.0x2da0]
[New Thread 2888.0x2c08]
[New Thread 2888.0x24ac]
[New Thread 2888.0x1ee8]
[New Thread 2888.0x1fc]
[New Thread 2888.0x153c]
[New Thread 2888.0x2784]
[New Thread 2888.0x524]
[New Thread 2888.0x1614]
[New Thread 2888.0x2168]
[New Thread 2888.0xa4c]
[New Thread 2888.0x2344]
[New Thread 2888.0x2c40]
[New Thread 2888.0x11e0]
[New Thread 2888.0x1a30]
[New Thread 2888.0x2660]
[New Thread 2888.0x2e18]
[New Thread 2888.0x2a80]
[New Thread 2888.0x1ba4]
[New Thread 2888.0x15c8]
[New Thread 2888.0x270c]
[New Thread 2888.0x694]
[New Thread 2888.0x2764]
[New Thread 2888.0xe74]
[New Thread 2888.0x2914]
[New Thread 2888.0xf5c]
[New Thread 2888.0x1420]
[New Thread 2888.0x2f90]
[New Thread 2888.0x810]
[New Thread 2888.0x22cc]
Reading symbols from /cygdrive/c/Program Files (x86)/emacs-trunk/bin/emacs.exe...done.
0x7727f925 in ntdll!DbgBreakPoint () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
(gdb) thread 1
[Switching to thread 1 (Thread 2888.0x233c)]
#0  0x0111cd8e in looking_at_1 (string=<optimized out>, posix=<optimized out>) at c:/msys/home/Dani/em
333     c:/msys/home/Dani/emacs/trunk/src/search.c: No such file or directory.
(gdb) finish
Run till exit from #0  0x0111cd8e in looking_at_1 (string=<optimized out>, posix=<optimized out>) at c:/msys/home/Dani/emacs/trunk/src/search.c:333
0x0114e182 in Ffuncall (nargs=2, args=0x88ccb4) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2723
2723    c:/msys/home/Dani/emacs/trunk/src/eval.c: No such file or directory.
Value returned is $1 = 21994682
(gdb) finish
Run till exit from #0  0x0114e182 in Ffuncall (nargs=2, args=0x88ccb4) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2723
error return /usr/src/ports/gdb/gdb-7.8-2.i686/src/gdb-7.8/gdb/windows-nat.c:1239 was 5
[Thread 2888.0x22cc exited with code 0]
0x0118ab67 in exec_byte_code (bytestr=21994682, vector=780, maxdepth=2, args_template=21994650, nargs=21994650, args=0x0) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
920     c:/msys/home/Dani/emacs/trunk/src/bytecode.c: No such file or directory.
Value returned is $2 = 21994682
(gdb) finish
Run till exit from #0  0x0118ab67 in exec_byte_code (bytestr=21994682, vector=780, maxdepth=2, args_template=21994650, nargs=21994650, args=0x0) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
funcall_lambda (fun=19768957, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88ce44) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2962
2962    c:/msys/home/Dani/emacs/trunk/src/eval.c: No such file or directory.
Value returned is $3 = 0
(gdb) finish
Run till exit from #0  funcall_lambda (fun=19768957, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88ce44) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2962
0x0114deeb in Ffuncall (nargs=2, args=0x88ce40) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
2784    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $4 = 0
(gdb) finish
Run till exit from #0  0x0114deeb in Ffuncall (nargs=2, args=0x88ce40) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
0x0114d56d in eval_sub (form=form@entry=123976582) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2151
2151    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $5 = 0
(gdb) finish
Run till exit from #0  0x0114d56d in eval_sub (form=form@entry=123976582) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2151
apply_lambda (fun=19064021, args=<optimized out>, count=count@entry=66) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2824
2824    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $6 = 0
(gdb) finish
Run till exit from #0  apply_lambda (fun=19064021, args=<optimized out>, count=count@entry=66) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2824
eval_sub (form=123976598) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2249
2249    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $7 = 0
(gdb) finish
Run till exit from #0  eval_sub (form=123976598) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2249
0x0114d723 in Fsetq (args=<optimized out>) at c:/msys/home/Dani/emacs/trunk/src/eval.c:532
532     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $8 = 0
(gdb) finish
Run till exit from #0  0x0114d723 in Fsetq (args=<optimized out>) at c:/msys/home/Dani/emacs/trunk/src/eval.c:532
510     in c:/msys/home/Dani/emacs/trunk/src/eval.c
(gdb) finish
Run till exit from #0  Fsetq (args=123976614) at c:/msys/home/Dani/emacs/trunk/src/eval.c:510
0x0114d1d2 in eval_sub (form=123976622) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
2128    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $9 = 0
(gdb) finish
Run till exit from #0  0x0114d1d2 in eval_sub (form=123976622) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
0x0114d1d2 in eval_sub (form=123974750) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
2128    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $10 = 0
(gdb) finish
Run till exit from #0  0x0114d1d2 in eval_sub (form=123974750) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
Fprogn (body=123974766) at c:/msys/home/Dani/emacs/trunk/src/eval.c:456
456     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $11 = 0
(gdb) finish
Run till exit from #0  Fprogn (body=123974766) at c:/msys/home/Dani/emacs/trunk/src/eval.c:456
0x01150d8c in Flet (args=123974774) at c:/msys/home/Dani/emacs/trunk/src/eval.c:963
963     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $12 = 0
(gdb) finish
Run till exit from #0  0x01150d8c in Flet (args=123974774) at c:/msys/home/Dani/emacs/trunk/src/eval.c:963
0x0114d1d2 in eval_sub (form=123974782) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
2128    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $13 = 0
(gdb) finish
Run till exit from #0  0x0114d1d2 in eval_sub (form=123974782) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
Fprogn (body=123974790) at c:/msys/home/Dani/emacs/trunk/src/eval.c:456
456     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $14 = 0
(gdb) finish
Run till exit from #0  Fprogn (body=123974790) at c:/msys/home/Dani/emacs/trunk/src/eval.c:456
0x0114dc0e in funcall_lambda (fun=123974806, nargs=nargs@entry=2, arg_vector=arg_vector@entry=0x88d420) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2949
2949    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $15 = 0
(gdb) finish
Run till exit from #0  0x0114dc0e in funcall_lambda (fun=123974806, nargs=nargs@entry=2, arg_vector=arg_vector@entry=0x88d420) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2949
0x0114deeb in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x88d41c) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
2784    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $16 = 0
(gdb) finish
Run till exit from #0  0x0114deeb in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x88d41c) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
0x0114f0c6 in Fapply (nargs=3, args=0x88d41c) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2292
2292    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $17 = 0
(gdb) finish
Run till exit from #0  0x0114f0c6 in Fapply (nargs=3, args=0x88d41c) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2292
0x0114e1e3 in Ffuncall (nargs=4, args=0x88d418) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2703
2703    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $18 = 0
(gdb) finish
Run till exit from #0  0x0114e1e3 in Ffuncall (nargs=4, args=0x88d418) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2703
0x0118ab67 in exec_byte_code (bytestr=0, vector=580, maxdepth=4, args_template=512, nargs=1, args=0x88d598) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
920     c:/msys/home/Dani/emacs/trunk/src/bytecode.c: No such file or directory.
Value returned is $19 = 0
(gdb) finish
Run till exit from #0  0x0118ab67 in exec_byte_code (bytestr=0, vector=580, maxdepth=4, args_template=512, nargs=1, args=0x88d598) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
funcall_lambda (fun=124221373, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88d598) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2963
2963    c:/msys/home/Dani/emacs/trunk/src/eval.c: No such file or directory.
Value returned is $20 = 0
(gdb) finish
Run till exit from #0  funcall_lambda (fun=124221373, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88d598) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2963
0x0114deeb in Ffuncall (nargs=2, args=0x88d594) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
2784    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $21 = 0
(gdb) finish
Run till exit from #0  0x0114deeb in Ffuncall (nargs=2, args=0x88d594) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
0x0118ab67 in exec_byte_code (bytestr=0, vector=570, maxdepth=2, args_template=21994650, nargs=0, args=0x0) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
920     c:/msys/home/Dani/emacs/trunk/src/bytecode.c: No such file or directory.
Value returned is $22 = 0
(gdb) finish
Run till exit from #0  0x0118ab67 in exec_byte_code (bytestr=0, vector=570, maxdepth=2, args_template=21994650, nargs=0, args=0x0) at c:/msys/home/Dani/emacs/trunk/src/bytecode.c:920
funcall_lambda (fun=19769173, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88d714) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2962
2962    c:/msys/home/Dani/emacs/trunk/src/eval.c: No such file or directory.
Value returned is $23 = 0
(gdb) finish
Run till exit from #0  funcall_lambda (fun=19769173, nargs=nargs@entry=1, arg_vector=arg_vector@entry=0x88d714) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2962
0x0114deeb in Ffuncall (nargs=2, args=0x88d710) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
2784    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $24 = 0
(gdb) finish
Run till exit from #0  0x0114deeb in Ffuncall (nargs=2, args=0x88d710) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2784
0x0114d56d in eval_sub (form=form@entry=124088886) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2151
2151    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $25 = 0
(gdb) finish
Run till exit from #0  0x0114d56d in eval_sub (form=form@entry=124088886) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2151
apply_lambda (fun=19064021, args=<optimized out>, count=count@entry=53) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2824
2824    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $26 = 0
(gdb) finish
Run till exit from #0  apply_lambda (fun=19064021, args=<optimized out>, count=count@entry=53) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2824
eval_sub (form=124088902) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2249
2249    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $27 = 0
(gdb) finish
Run till exit from #0  eval_sub (form=124088902) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2249
0x0114d723 in Fsetq (args=<optimized out>) at c:/msys/home/Dani/emacs/trunk/src/eval.c:532
532     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $28 = 0
(gdb) finish
Run till exit from #0  0x0114d723 in Fsetq (args=<optimized out>) at c:/msys/home/Dani/emacs/trunk/src/eval.c:532
510     in c:/msys/home/Dani/emacs/trunk/src/eval.c
(gdb) finish
Run till exit from #0  Fsetq (args=124088918) at c:/msys/home/Dani/emacs/trunk/src/eval.c:510
0x0114d1d2 in eval_sub (form=124088926) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
2128    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $29 = 0
(gdb) finish
Run till exit from #0  0x0114d1d2 in eval_sub (form=124088926) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
0x0114d1d2 in eval_sub (form=124089070) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
2128    in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $30 = 0
(gdb)
Run till exit from #0  0x0114d1d2 in eval_sub (form=124089070) at c:/msys/home/Dani/emacs/trunk/src/eval.c:2128
Fprogn (body=124089086) at c:/msys/home/Dani/emacs/trunk/src/eval.c:456
456     in c:/msys/home/Dani/emacs/trunk/src/eval.c
Value returned is $31 = 0
(gdb)
--8<---------------cut here---------------end--------------->8---

I've typed "finish" 30 times; not sure when to stop. I still will keep
that Emacs open for now, so that you can ask me to work on it.

BTW, I really can reproduce the bug quite reliably: I open the LOGBOOK
drawer, start from the next subtree, and press left-arrow until I arrive
at the current timestamp. Emacs goes crazy when crossing the closing
bracket (see http://screencast.com/t/IReK7hx8 on where cursor stays
blocked).

Note that:

- I only press left-arrow, no other key, to move up to the point which
  I want to edit,
- It happens even with small drawers (of 2 lines),
- It sometimes unblock by itself (after less than 2 minutes).