diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-06-20 11:57:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-20 11:57:00 +0200 |
commit | 878cd5d88fc38fe0131455c84a6793c562238f70 (patch) | |
tree | 985ea8438f503b4730515b5602c9d76e4e590acb /src/vm/finalizerthread.h | |
parent | b464dc317d49b84cf2e3a2e4f65813c23ea51a41 (diff) | |
download | coreclr-878cd5d88fc38fe0131455c84a6793c562238f70.tar.gz coreclr-878cd5d88fc38fe0131455c84a6793c562238f70.tar.bz2 coreclr-878cd5d88fc38fe0131455c84a6793c562238f70.zip |
Fix GC background thread start in OOM (#5840)
This change fixes a problem that happened when the `gc_heap::create_bgc_thread`
calls SetupUnstartedThread and it fails to allocate a Thread object and throws.
The GC doesn't expect that and so when the stack is unwound, the `gc_heap::gc_started`
stays set. Now we try to allocate memory for the Throwable for the exception, so we go
to GC heap and since there is not enough space, we end up calling
`gc_heap::try_allocate_more_space`, which calls `gc_heap::wait_for_gc_done`.
And that’s the end of it, since the `gc_started` is still set and we wait forever.
The fix is to catch exception from the SetupUnstartedThread. I have also fixed couple of
places where this method was being called and the exception was not expected.
As an additional cleanup, I have moved the thread creation in GC to the GCToEEInterface.
Diffstat (limited to 'src/vm/finalizerthread.h')
-rw-r--r-- | src/vm/finalizerthread.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vm/finalizerthread.h b/src/vm/finalizerthread.h index 42a9e9f250..90dd3e9ec9 100644 --- a/src/vm/finalizerthread.h +++ b/src/vm/finalizerthread.h @@ -91,7 +91,7 @@ public: static void FinalizeObjectsOnShutdown(LPVOID args); static DWORD __stdcall FinalizerThreadStart(void *args); - static DWORD FinalizerThreadCreate(); + static void FinalizerThreadCreate(); static BOOL FinalizerThreadWatchDog(); }; |