Subject: Re: bug#14986: Latest Emacs trunk crashes when changing Ispell dictionary

From: "Sebastien Vauban" <[email-masked]>
Date: Tue, 30 Jul 2013 21:46:55 +0200

Eli Zaretskii wrote:
>> From: "Sebastien Vauban" <[email-masked]>
>> Date: Tue, 30 Jul 2013 17:00:13 +0200
>> 
>> When using the following code on any buffer (email, document, etc.):
>> 
>> --8<---------------cut here---------------start------------->8---
>>   (defun my/flyspell-toggle-dictionary ()
>>     "Change the dictionary."
>>     (interactive)
>>     (let ((dict (or ispell-local-dictionary
>>                     ispell-dictionary)))
>>       (setq dict (if (string= dict "francais") "american" "francais"))
>>       (message "Switched to %S" dict)
>>       (sit-for 0.5)
>>       (ispell-change-dictionary dict)
>>       (when flyspell-mode
>>         (flyspell-buffer))))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> I've had multiple crashes (3 or 4, over 2 days) with the latest Emacs trunk.
>> 
>> The crash happens at the exact time of calling the above code (through a key
>> binding).
>
> Any chance of getting a backtrace from GDB?

Here it is...

--8<---------------cut here---------------start------------->8---
GNU gdb (GDB) 7.6.50.20130508-cvs (cygwin-special)
Copyright (C) 2013 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-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Attaching to process 3460
[New Thread 3460.0x103c]
[New Thread 3460.0x1520]
[New Thread 3460.0x604]
[New Thread 3460.0x14b0]
[New Thread 3460.0xc84]
[New Thread 3460.0x998]
Reading symbols from /cygdrive/c/Program Files (x86)/emacs-trunk/bin/emacs.exe...done.
(gdb) continue
Continuing.
[Thread 3460.0x998 exited with code 0]

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 3460.0x103c]
0x76909bfd in KERNELBASE!DebugBreak () from /cygdrive/c/Windows/SYSTEM32/KERNELBASE.dll
(gdb) thread apply all backtrace

Thread 5 (Thread 3460.0xc84):
#0  0x77b2dc34 in ntdll!ZwWaitForSingleObject () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#1  0x76881129 in WaitForSingleObjectEx () from /cygdrive/c/Windows/SYSTEM32/KERNELBASE.dll
#2  0x00000260 in ?? ()
#3  0x00000000 in ?? ()

Thread 4 (Thread 3460.0x14b0):
#0  0x77b2f6b4 in ntdll!ZwWaitForWorkViaWorkerFactory () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#1  0x77b24524 in ntdll!TpIsTimerSet () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#2  0x75d9850d in KERNEL32!BaseThreadInitThunk () from /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL
#3  0x77b5bf39 in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#4  0x77b5bf0c in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#5  0x00000000 in ?? ()

Thread 3 (Thread 3460.0x604):
#0  0x7545b891 in USER32!CharNextA () from /cygdrive/c/Windows/SYSTEM32/USER32.dll
#1  0x011df39b in w32_msg_pump (msg_buf=0x6bd9ff24) at c:/msys/home/dani/emacs/trunk/src/w32fns.c:2444
#2  0x011df5d9 in w32_msg_worker@4 (arg=0x0) at c:/msys/home/dani/emacs/trunk/src/w32fns.c:2670
#3  0x75d9850d in KERNEL32!BaseThreadInitThunk () from /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL
#4  0x77b5bf39 in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#5  0x77b5bf0c in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#6  0x00000000 in ?? ()

Thread 2 (Thread 3460.0x1520):
#0  0x77b2f6b4 in ntdll!ZwWaitForWorkViaWorkerFactory () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#1  0x77b24524 in ntdll!TpIsTimerSet () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#2  0x75d9850d in KERNEL32!BaseThreadInitThunk () from /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL
#3  0x77b5bf39 in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#4  0x77b5bf0c in ntdll!RtlInitializeExceptionChain () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll
#5  0x00000000 in ?? ()

Thread 1 (Thread 3460.0x103c):
#0  0x76909bfd in KERNELBASE!DebugBreak () from /cygdrive/c/Windows/SYSTEM32/KERNELBASE.dll
#1  0x011ea214 in emacs_abort () at c:/msys/home/dani/emacs/trunk/src/w32fns.c:8030
#2  0x010db2e8 in terminate_due_to_signal (sig=22, backtrace_limit=2147483647) at c:/msys/home/dani/emacs/trunk/src/emacs.c:369
#3  0x011503d5 in die (msg=0x147f8a2 <baud_convert+482> "errno != EBADF || fd < 0", file=0x147f708 <baud_convert+72> "c:/msys/home/dani/emacs/trunk/src/sysdep.c",
    line=2272) at c:/msys/home/dani/emacs/trunk/src/alloc.c:6558
#4  0x010ff747 in emacs_close (fd=2147483647) at c:/msys/home/dani/emacs/trunk/src/sysdep.c:2272
#5  0x011c0654 in create_temp_file (nargs=12, args=0x88e264) at c:/msys/home/dani/emacs/trunk/src/callproc.c:1027
#6  0x011c0965 in Fcall_process_region (nargs=12, args=0x88e264) at c:/msys/home/dani/emacs/trunk/src/callproc.c:1118
#7  0x0116d79a in Ffuncall (nargs=13, args=0x88e260) at c:/msys/home/dani/emacs/trunk/src/eval.c:2797
#8  0x0116cdd5 in Fapply (nargs=2, args=0x88e3a8) at c:/msys/home/dani/emacs/trunk/src/eval.c:2355
#9  0x0116d79a in Ffuncall (nargs=3, args=0x88e3a4) at c:/msys/home/dani/emacs/trunk/src/eval.c:2797
#10 0x011ae275 in exec_byte_code (bytestr=94651473, vector=103194125, maxdepth=12, args_template=54732826, nargs=0, args=0x0)
    at c:/msys/home/dani/emacs/trunk/src/bytecode.c:905
#11 0x0116e450 in funcall_lambda (fun=103194165, nargs=12, arg_vector=0x6269e0d) at c:/msys/home/dani/emacs/trunk/src/eval.c:3050
#12 0x0116dae6 in Ffuncall (nargs=13, args=0x88e680) at c:/msys/home/dani/emacs/trunk/src/eval.c:2865
#13 0x0116cdd5 in Fapply (nargs=9, args=0x88e7c8) at c:/msys/home/dani/emacs/trunk/src/eval.c:2355
---Type <return> to continue, or q <return> to quit---
#14 0x0116d79a in Ffuncall (nargs=10, args=0x88e7c4) at c:/msys/home/dani/emacs/trunk/src/eval.c:2797
#15 0x011ae275 in exec_byte_code (bytestr=59122705, vector=108041781, maxdepth=44, args_template=54732826, nargs=0, args=0x0)
    at c:/msys/home/dani/emacs/trunk/src/bytecode.c:905
#16 0x0116e450 in funcall_lambda (fun=108042021, nargs=2, arg_vector=0x6709635) at c:/msys/home/dani/emacs/trunk/src/eval.c:3050
#17 0x0116dae6 in Ffuncall (nargs=3, args=0x88eac4) at c:/msys/home/dani/emacs/trunk/src/eval.c:2865
#18 0x011ae275 in exec_byte_code (bytestr=56121793, vector=108042045, maxdepth=12, args_template=54732826, nargs=0, args=0x0)
    at c:/msys/home/dani/emacs/trunk/src/bytecode.c:905
#19 0x0116e450 in funcall_lambda (fun=108042077, nargs=2, arg_vector=0x670973d) at c:/msys/home/dani/emacs/trunk/src/eval.c:3050
#20 0x0116dae6 in Ffuncall (nargs=3, args=0x88eda4) at c:/msys/home/dani/emacs/trunk/src/eval.c:2865
#21 0x011ae275 in exec_byte_code (bytestr=56122673, vector=108007413, maxdepth=12, args_template=54732826, nargs=0, args=0x0)
    at c:/msys/home/dani/emacs/trunk/src/bytecode.c:905
#22 0x0116e450 in funcall_lambda (fun=108042109, nargs=0, arg_vector=0x6700ff5) at c:/msys/home/dani/emacs/trunk/src/eval.c:3050
#23 0x0116ddab in apply_lambda (fun=108042109, args=54732826) at c:/msys/home/dani/emacs/trunk/src/eval.c:2925
#24 0x0116c753 in eval_sub (form=57834734) at c:/msys/home/dani/emacs/trunk/src/eval.c:2231
#25 0x01168502 in Fprogn (body=83214110) at c:/msys/home/dani/emacs/trunk/src/eval.c:460
#26 0x0116c24a in eval_sub (form=83214102) at c:/msys/home/dani/emacs/trunk/src/eval.c:2134
#27 0x0116828c in Fif (args=83214086) at c:/msys/home/dani/emacs/trunk/src/eval.c:411
#28 0x0116c24a in eval_sub (form=83214078) at c:/msys/home/dani/emacs/trunk/src/eval.c:2134
#29 0x01168502 in Fprogn (body=83214014) at c:/msys/home/dani/emacs/trunk/src/eval.c:460
#30 0x01169b88 in Flet (args=83214006) at c:/msys/home/dani/emacs/trunk/src/eval.c:931
#31 0x0116c24a in eval_sub (form=83213270) at c:/msys/home/dani/emacs/trunk/src/eval.c:2134
#32 0x01168502 in Fprogn (body=83213094) at c:/msys/home/dani/emacs/trunk/src/eval.c:460
#33 0x0116e3bb in funcall_lambda (fun=83213262, nargs=0, arg_vector=0x88f674) at c:/msys/home/dani/emacs/trunk/src/eval.c:3043
#34 0x0116dbb9 in Ffuncall (nargs=1, args=0x88f670) at c:/msys/home/dani/emacs/trunk/src/eval.c:2877
#35 0x0116d30c in apply1 (fn=84386466, arg=54732826) at c:/msys/home/dani/emacs/trunk/src/eval.c:2582
#36 0x01165c6b in Fcall_interactively (function=84386466, record_flag=54732826, keys=54779909) at c:/msys/home/dani/emacs/trunk/src/callint.c:381
#37 0x0116d8ff in Ffuncall (nargs=4, args=0x88f87c) at c:/msys/home/dani/emacs/trunk/src/eval.c:2823
#38 0x011ae275 in exec_byte_code (bytestr=19717001, vector=19717021, maxdepth=52, args_template=4100, nargs=1, args=0x88fb80)
    at c:/msys/home/dani/emacs/trunk/src/bytecode.c:905
#39 0x0116e08c in funcall_lambda (fun=19716981, nargs=1, arg_vector=0x88fb7c) at c:/msys/home/dani/emacs/trunk/src/eval.c:2984
#40 0x0116dae6 in Ffuncall (nargs=2, args=0x88fb78) at c:/msys/home/dani/emacs/trunk/src/eval.c:2865
#41 0x0116d395 in call1 (fn=54778722, arg1=84386466) at c:/msys/home/dani/emacs/trunk/src/eval.c:2615
#42 0x010df5b3 in command_loop_1 () at c:/msys/home/dani/emacs/trunk/src/keyboard.c:1560
#43 0x0116a713 in internal_condition_case (bfun=0x10ded8d <command_loop_1>, handlers=54787290, hfun=0x10de614 <cmd_error>)
    at c:/msys/home/dani/emacs/trunk/src/eval.c:1302
#44 0x010dea42 in command_loop_2 (ignore=54732826) at c:/msys/home/dani/emacs/trunk/src/keyboard.c:1161
#45 0x0116a02d in internal_catch (tag=54777170, func=0x10dea1e <command_loop_2>, arg=54732826) at c:/msys/home/dani/emacs/trunk/src/eval.c:1076
#46 0x010de9fa in command_loop () at c:/msys/home/dani/emacs/trunk/src/keyboard.c:1140
#47 0x010de1b1 in recursive_edit_1 () at c:/msys/home/dani/emacs/trunk/src/keyboard.c:779
#48 0x010de36d in Frecursive_edit () at c:/msys/home/dani/emacs/trunk/src/keyboard.c:843
#49 0x010dc63b in main (argc=1, argv=0xf81370) at c:/msys/home/dani/emacs/trunk/src/emacs.c:1566
(gdb)
--8<---------------cut here---------------end--------------->8---

To reproduce the problem (seems quite doable, now):

1. Launch Emacs
2. Launch Gnus
3. Respond to a (long?) email
4. Change dictionary

Best regards,
  Seb

-- 
Sebastien Vauban