Fix a very rare hang on sgen.
commit2f739140ced15098c2f3c91af135a05fb5e84927
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 21 May 2012 15:29:53 +0000 (21 12:29 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 21 May 2012 15:39:46 +0000 (21 12:39 -0300)
tree34052bef9ef93e0345a0ed6ec2c3f743e90aa693
parentd819ff3031388684c986c77dd9ab0d486e08a249
Fix a very rare hang on sgen.

* sgen-gc.c (restart_threads_until_none_in_managed_allocator):
When suspending threads, if a given thread was suspended on
a gc unsafe point we restart it until it land on a safe zone.

Since we restart the thread, it might die before we get the chance
to suspend it again, we take this into account except when waiting
for acks. We mistakenly waited for the same number of acks of the
restart step. It could have been reduced if a thread died.

This bug is very very hard to hit as it only happens on linux,
requires that a thread on an unsafe point dies right after been
restarted and it must not be a managed thread as those must take
the GC lock while cleaning up.

This sums up to a mostly theoretical bug that someone might
have observed once in the wild. We're better fixing it now
since further optimization work might make it easier to hit.
mono/metadata/sgen-gc.c