Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
drodov opened this issue Jun 23, 2017 · 6 comments

Comments

@drodov
Copy link

drodov commented Jun 23, 2017

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

@Taritsyn
Copy link
Owner

Hello, Dmitry!

When I have free time, I will research this problem.

Have you tried to upgrade the JavaScriptEngineSwitcher.ChakraCore to the latest version?

@Taritsyn
Copy link
Owner

Taritsyn commented Jun 27, 2017

Try to upgrade to version 2.4.8. If after upgrade will encounter errors, then read the “Updating JavascriptEngineSwitcher.V8 breaks React.Net” discussion.

@drodov
Copy link
Author

drodov commented Jun 28, 2017

Thanks a lot!

@Taritsyn Taritsyn closed this as completed Jul 3, 2017
@drodov
Copy link
Author

drodov commented Jul 7, 2017

Hello, @Taritsyn! We faced this issue again. We use version 2.4.8.

@Taritsyn
Copy link
Owner

Taritsyn commented Jul 7, 2017

Hello, Dmitry!

Frankly, I do not even know where else to find the cause of this error. As far as I know, this error did not occur at other users.

Try to upgrade the React.NET to version 3.1 (there are a lot of changes) and set the ChakraCoreJsEngine as default engine (see the “Registration of JS engines” section of documentation).

I also recommend to upgrade the JavaScript Engine Switcher to version 2.4.10. In this version was improved error handling and optimized memory consumption.

@Taritsyn Taritsyn reopened this Jul 7, 2017
Taritsyn added a commit that referenced this issue May 24, 2018
…thread is blocked because of JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine”
@Taritsyn
Copy link
Owner

Hello, Dmitry!

Try to upgrade to version 2.4.18.

Taritsyn added a commit that referenced this issue May 29, 2018
…thread is blocked because of JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine”
@Taritsyn Taritsyn closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants