Re[7]: [Gc] Re: pthread_cancel(3) confuses 'GC_suspend_all ()'

Ivan Maidanski ivmai at mail.ru
Tue Sep 22 23:14:08 PDT 2009


Hi!

"Boehm, Hans" <hans.boehm at hp.com> wrote:
> Thanks.  I merged both of those into my tree, and found another minor problem, in that the collector turned pthread_create into a cancellation point.  (Apparently a breakpoint in __pthread_unwind() can give some idea from gdb of where cancellations are delivered.  There should be a better way.)
> 
> After that, it looks to me like the test program has some issues that may hide other problems:
> 
> - cancellation and thread creation race, meaning that the number of threads can potentially get huge.
> 
> - my impression is that if cancellation isn't delivered while the thread is running, it isn't delivered at all.  This means late cancellations result in thread leaks, and you can get truly impressive proces sizes, with almost none of that in the GC heap.  I think this starts to look like a hang after a while.  Since the GC calls shouldn't be cancellation points, all of this is becoming more likely as I fix things.  (Detaching threads doesn't seem to work, since that seems to cause pthread_cancel to crash if it's too late.)
> 
> Here's my attempt at a revised patch and a better (and unfortunately probably less aggressive) test program.

Minor correction is required:

1. GC_try_to_collect: "DCL_LOCK_STATE;" should be the last one in locals declaration part (because DCL_LOCK_STATE might be empty and a single ";" is an empty statement in C);

2. A bit "mis-indentified" code:
#   if defined(GC_ASSERTIONS) && (defined(USE_COMPILER_TLS) \
       || (defined(LINUX) && !defined(ARM32) \
                  && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) \
		         || defined(HPUX) /* and probably others ... */))

->

#   if defined(GC_ASSERTIONS) && (defined(USE_COMPILER_TLS) \
       || (defined(LINUX) && !defined(ARM32) \
                && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) \
       || defined(HPUX) /* FIXME: and probably others ... */))


Also: Do we need this for Cygwin? I guess no, right?

Bye.


More information about the Gc mailing list