Skip to content

Finalazier thread is blocked becasue of JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine #34

@drodov

Description

@drodov

Hi, @Taritsyn! First of all thanks for your great work on this project!
We use JavaScriptEngineSwitcher.ChakraCore 2.3.2 with ReactJS.NET. But from time to time we are facing the issue that our azure web app crashes and doesn't response. After looking into memory dump I've found that the reason of that is that finalizer thread is blocked. It becomes blocked after trying to finalize ChakraCoreJsEngine.
According to version history I found that similar issue was fixed in 2.3.2 version but looks like not completely. Could you please help with fixing this issue?
Maybe something is going wrong because of using reference type objects in Finalize method.
I attached a stack trace below.

This thread is waiting in a WaitOne

.NET Call Stack

[[HelperMethodFrame_1OBJ] (System.Threading.WaitHandle.WaitOneNative)] System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
mscorlib_ni!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)+21
mscorlib_ni!System.Threading.WaitHandle.WaitOne(Int32, Boolean)+28
mscorlib_ni!System.Threading.WaitHandle.WaitOne()+12
JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.InnnerInvoke(System.Func`1)+54
JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.Invoke(System.Action)+52
JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.Dispose(Boolean)+48
JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.Finalize()+1b
[[DebuggerU2MCatchHandlerFrame]]
[[ContextTransitionFrame]]
[[GCFrame]]
[[DebuggerU2MCatchHandlerFrame]]

Full Call Stack
ntdll!NtWaitForMultipleObjects+c
KERNELBASE!WaitForMultipleObjectsEx+10b
clr!WaitForMultipleObjectsEx_SO_TOLERANT+3c
clr!Thread::DoAppropriateWaitWorker+237
clr!Thread::DoAppropriateWait+64
clr!WaitHandleNative::CorWaitOneNative+163
[[HelperMethodFrame_1OBJ] (System.Threading.WaitHandle.WaitOneNative)] System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean)
mscorlib_ni!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)+21
mscorlib_ni!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)+21
mscorlib_ni!System.Threading.WaitHandle.WaitOne(Int32, Boolean)+28
mscorlib_ni!System.Threading.WaitHandle.WaitOne(Int32, Boolean)+28
mscorlib_ni!System.Threading.WaitHandle.WaitOne()+12
mscorlib_ni!System.Threading.WaitHandle.WaitOne()+12
JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.InnnerInvoke(System.Func`1<System.Object>)+54
JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.Invoke(System.Action)+52
JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.Dispose(Boolean)+48
JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine.Finalize()+1b
clr!FastCallFinalize+6d
clr!MethodTable::CallFinalizer+139
clr!CallFinalizer+a6
clr!FinalizerThread::FinalizeAllObjects+a6
clr!FinalizerThread::FinalizeAllObjects_Wrapper+14
clr!ManagedThreadBase_DispatchInner+71
clr!ManagedThreadBase_DispatchMiddle+7e
clr!ManagedThreadBase_DispatchOuter+5b
[[DebuggerU2MCatchHandlerFrame]]
clr!ManagedThreadBase_DispatchInCorrectAD+15
clr!Thread::DoADCallBack+30f
[[ContextTransitionFrame]]
clr!ManagedThreadBase_DispatchInner+5f
clr!FinalizerThread::DoOneFinalization+129
[[GCFrame]]
clr!FinalizerThread::FinalizeAllObjects+a6
clr!FinalizerThread::FinalizerThreadWorker+ed
clr!ManagedThreadBase_DispatchInner+71
clr!ManagedThreadBase_DispatchMiddle+7e
clr!ManagedThreadBase_DispatchOuter+5b
[[DebuggerU2MCatchHandlerFrame]]
clr!ManagedThreadBase::FinalizerBase+33
clr!FinalizerThread::FinalizerThreadStart+d4
clr!Thread::intermediateThreadProc+55
kernel32!BaseThreadInitThunk+e
ntdll!__RtlUserThreadStart+72
ntdll!_RtlUserThreadStart+1b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions