Subject: Re: bug#14569: 24.3.50; bootstrap fails on Cygwin

From: Jan Djärv <[email-masked]>
Date: Tue, 11 Jun 2013 17:39:00 +0200

Hello.

10 jun 2013 kl. 20:56 skrev Angelo Graziosi <[email-masked]>:

> Il 10/06/2013 18.27, Jan Djärv ha scritto:
>> Hello.
>> 
>> This sounds like a bug in GLib.  Put a breakpoint at g_thread_abort to get a useful backtrace.
> 
> I am afraid but GDB is not for me... :(

The error is not even consistent, it only occurs sometimes.  There seems to be a random memory corruption going on.  Sometimes bootstrap fails with a core dump, sometimes with

GLib (gthread-posix.c): Unexpected error from C library during 'pthread_setspecific': Invalid argument.  Aborting.

And this is while compiling .el-files.  It is not crashing in the same .el-file, many files compile just fine before the crash happens (if it happens).  Redoing the make after a crash usually produces an Emacs executable.  It seems to run fine, but I haven't run it for a very long time.  Maybe the bug manifests itself only in bootstrap-emacs when using GLib?

I got one backtrace for the setspecific error:

Breakpoint 1, 0x610dcd26 in abort () from /usr/bin/cygwin1.dll
(gdb) bt
#0  0x610dcd26 in abort () from /usr/bin/cygwin1.dll
#1  0x6a90d066 in g_spawn_close_pid () from /usr/bin/cygglib-2.0-0.dll
#2  0x6a908e8c in g_private_set () from /usr/bin/cygglib-2.0-0.dll
#3  0x6a8f06ce in g_thread_self () from /usr/bin/cygglib-2.0-0.dll
#4  0x6a8ce250 in g_main_context_iteration () from /usr/bin/cygglib-2.0-0.dll
#5  0x6a8ce2aa in g_main_context_iteration () from /usr/bin/cygglib-2.0-0.dll
#6  0x6a8f017d in g_thread_proxy () from /usr/bin/cygglib-2.0-0.dll
#7  0x610ffe1a in pthread::thread_init_wrapper(void*) ()
   from /usr/bin/cygwin1.dll
#8  0x6108974c in thread_wrapper(void*) () from /usr/bin/cygwin1.dll

This is in a separate thread, Emacs is executing in another thread:

(gdb) info threads
  Id   Target Id         Frame
* 3    Thread 1564.0x2d4 0x610dcd26 in abort () from /usr/bin/cygwin1.dll
  2    Thread 1564.0xfd0 0x7c90e514 in ntdll!KiFastSystemCallRet ()
   from /cygdrive/c/WINDOWS/system32/ntdll.dll
  1    Thread 1564.0xa8c 0x0054b2d5 in oblookup (obarray=<optimized out>,
    ptr=<optimized out>, size=10, size_byte=<optimized out>) at lread.c:3905
(gdb) thr 1
[Switching to thread 1 (Thread 1564.0xa8c)]
#0  0x0054b2d5 in oblookup (obarray=<optimized out>, ptr=<optimized out>,
    size=10, size_byte=<optimized out>) at lread.c:3905
3905            if (SBYTES (SYMBOL_NAME (tail)) == size_byte

(gdb) thr 1
[Switching to thread 1 (Thread 1564.0xa8c)]
#0  0x0054b2d5 in oblookup (obarray=<optimized out>, ptr=<optimized out>,
    size=10, size_byte=<optimized out>) at lread.c:3905
3905            if (SBYTES (SYMBOL_NAME (tail)) == size_byte
(gdb) bt
#0  0x0054b2d5 in oblookup (obarray=<optimized out>, ptr=<optimized out>,
    size=10, size_byte=<optimized out>) at lread.c:3905
#1  0x0054b678 in intern_c_string_1 (
    str=0x779503 <targets.14003+4547> ":keepalive", len=10) at lread.c:3715
#2  0x0056b76b in intern_c_string (
    str=0x779503 <targets.14003+4547> ":keepalive") at lisp.h:3332
#3  init_process_emacs () at process.c:7144
#4  0x004bf335 in main (argc=<optimized out>, argv=0x22abc0) at emacs.c:1464
(gdb) fr3
Undefined command: "fr3".  Try "help".
(gdb) fr 3
#3  init_process_emacs () at process.c:7144
7144         subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);

As there seems to be no good memory debuggers for Cygwin, this will be hard to find.  I still think it is an GLib/Cygwin error.

	Jan D.