pthread::atforkchild()

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Mar 7 14:33:00 GMT 2006


On Mar  7 13:25, Dave Korn wrote:
> 
> 
>   I see it calls a list of callback functions:
> 
> ----------------------------------<snip>----------------------------------
> void
> pthread::atforkchild ()
> {
>   MT_INTERFACE->fixup_after_fork ();
> 
>   __fp_unlock_all ();
> 
>   callback *cb = MT_INTERFACE->pthread_child;
>   while (cb)
>     {
>       cb->cb ();
>       cb = cb->next;
>     }
> }
> ----------------------------------<snip>----------------------------------
> 
>   I got one of those SEGV-on-pressing-ctrl-C bugs, and fortunately error_start
> jumped in and grabbed it.  The backtrace is slightly obfuscated by the
> frameless function call to pthread::atforkchild() in between frok::child and
> (some random address in the data segment of) cygiconv-2.
> 
> ----------------------------------<snip>----------------------------------
> (gdb) bt
> #0  0x0061bab1 in riscos1_wctomb () from /usr/bin/cygiconv-2.dll
> #1  0x61051ff0 in frok::child (this=0x22eb70)
>     at /usr/build/src-winsup/winsup/cygwin/fork.cc:176
> #2  0x61052d43 in fork () at /usr/build/src-winsup/winsup/cygwin/fork.cc:528
> #3  0x6109b89f in _sigfe ()
>     at /usr/build/src-winsup/winsup/cygwin/cygtls.h:232
> #4  0x0022ed18 in ?? ()
> #5  0x6105db5a in malloc (size=4220284)
>     at /usr/build/src-winsup/winsup/cygwin/malloc_wrapper.cc:72
> #6  0x100103f0 in ?? ()
> #7  0x00000001 in ?? ()
> #8  0x00000000 in ?? () from
> (gdb)
> ----------------------------------<snip>----------------------------------
> 
>   Looking at the thread data, it appears well formed, but the callback address
> in the cb member of the one and only entry on the pthread_child list is
> plainly wrong.
> 
> ----------------------------------<snip>----------------------------------
> [...]
> (gdb) print *__cygwin_user_data->threadinterface->pthread_child
> $5 = {cb = 0x61bab0 <riscos1_wctomb+70640>, next = 0x0}

It certainly looks like a valid address.  Do you know which callbacks
are installed by the application?  You could also add some debug_printfs
to see which values are to be expected in the normal case.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list