This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: segfault in delete_handle(handle_list *)


On Wed, Mar 26, 2003 at 04:39:47PM -0500, Joe Buehler wrote:
>It looks like this corresponds to "hl->next = hl->next->next;" in the code:
>
>static void __stdcall
>delete_handle (handle_list *hl)
>{
>  handle_list *hnuke = hl->next;
>  debug_printf ("nuking handle '%s'", hnuke->name);
>  hl->next = hl->next->next;
>  memset (hnuke, 0, sizeof (*hnuke));
>}
>
>The segfault indicates that hl->next is a bad pointer.  But that doesn't
>make much sense because it was just dereferenced for the debug_printf().
>So that makes me suspect that there is a thread issue here.
>
>Before I dive in and try and figure this out, I have attached the
>fork() part of the strace output, in case the problem is obvious to someone 
>who
>knows this part of Cygwin well.  Is it possible that another thread is 
>walking
>the same handle list at the same time?

Yes, when a process is exiting.  You could try removing the '&& !exit_state' in
debug.cc and see if the problem goes away.

This wouldn't be an issue in a production DLL, fwiw.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]