Closed xtroncode closed 1 year ago
Hello, Meet!
Are you using an libChakraCore.so
assembly from the JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64 package? It's just that this assembly differs from the official one: Tomáš Deml's patch has been applied to it that fixes such errors.
Yes, I only have the following references related to it, also this happened with 3.7.2 as well
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore" Version="3.7.2" />
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.win-x64" Version="3.7.2" />
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64" Version="3.7.2" />
<PackageReference Include="JavaScriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.3.0" />
<PackageReference Include="React.AspNet" Version="5.2.5" />
Also lldb
output :
(lldb) bt
* thread #1: tid = 0, 0x00007f7665166cee libChakraCore.so`Memory::RecyclerWriteBarrierManager::WriteBarrier(void*) + 14, name = 'Carwale.UI', stop reason = signal SIGSEGV
* frame #0: 0x00007f7665166cee libChakraCore.so`Memory::RecyclerWriteBarrierManager::WriteBarrier(void*) + 14
frame #1: 0x00007f76652b11b5 libChakraCore.so`Js::FunctionCodeGenRuntimeData::GetInlinee(unsigned short) const + 37
frame #2: 0x00007f766518cf7c libChakraCore.so`void Js::FunctionCodeGenRuntimeData::MapInlineCaches<void Js::FunctionBody::CleanUpInlineCaches<false>()::{lambda(Js::InlineCache*)#1}>(void Js::FunctionBody::CleanUpInlineCaches<false>()::{lambda(Js::InlineCache*)#1}) const + 236
frame #3: 0x00007f7665189677 libChakraCore.so`void Js::FunctionBody::CleanUpInlineCaches<false>() + 1063
frame #4: 0x00007f766517f6e8 libChakraCore.so`Js::FunctionBody::CleanupRecyclerData(bool, bool) + 40
frame #5: 0x00007f7665176a70 libChakraCore.so`Js::FunctionBody::Cleanup(bool) + 48
frame #6: 0x00007f766517663b libChakraCore.so`Js::FunctionBody::RedeferFunction() + 43
frame #7: 0x00007f7665191dd8 libChakraCore.so`Js::ScriptContext::RedeferFunctionBodies(BVSparse<Memory::ArenaAllocator>*, unsigned int) + 968
frame #8: 0x00007f76651a9037 libChakraCore.so`ThreadContext::TryRedeferral() + 215
frame #9: 0x00007f76651a8e85 libChakraCore.so`ThreadContext::PostSweepRedeferralCallBack() + 53
frame #10: 0x00007f766515d2f9 libChakraCore.so`Memory::Recycler::Sweep(unsigned long, bool, bool) + 329
frame #11: 0x00007f766515e60a libChakraCore.so`Memory::Recycler::CollectOnConcurrentThread() + 298
frame #12: 0x00007f766515ded9 libChakraCore.so`Memory::Recycler::DoCollect(Memory::CollectionFlags) + 745
frame #13: 0x00007f766515e1ed libChakraCore.so`Memory::Recycler::FinishConcurrentCollect(Memory::CollectionFlags) + 525
frame #14: 0x00007f76651a7bd5 libChakraCore.so`ThreadContext::ExecuteRecyclerCollectionFunction(Memory::Recycler*, int (Memory::Recycler::*)(Memory::CollectionFlags), Memory::CollectionFlags) + 437
frame #15: 0x00007f7664f428ac libChakraCore.so`_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}::operator()() const + 188
frame #16: 0x00007f7664f4273e libChakraCore.so`_JsErrorCode GlobalAPIWrapper_Core<_JsErrorCode GlobalAPIWrapper_NoRecord<_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}>(_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1})::{lambda()#1}>(_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}) + 14
frame #17: 0x00007f7664f2572d libChakraCore.so`JsCollectGarbage + 29
frame #18: 0x00007f76cb9260d2
frame #19: 0x00007f76cb306749
frame #20: 0x00007f76cb2bc901
frame #21: 0x00007f76b7ce3dbc
frame #22: 0x00007f76b7ce376f
....
frame #135: 0x00007f7730d6f5ff libcoreclr.so`CallDescrWorkerInternal + 124
frame #136: 0x00007f7730c9f445 libcoreclr.so`CallDescrWorkerWithHandler(CallDescrData*, int) + 117
frame #137: 0x00007f7730c9ff20 libcoreclr.so`MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1264
frame #138: 0x00007f7730de9c2a libcoreclr.so`QueueUserWorkItemManagedCallback(void*) + 74
frame #139: 0x00007f7730c71645 libcoreclr.so`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 341
frame #140: 0x00007f7730c71cad libcoreclr.so`ManagedThreadBase::ThreadPool(void (*)(void*), void*) + 45
frame #141: 0x00007f7730dd557e libcoreclr.so`ManagedPerAppDomainTPCount::DispatchWorkItem(bool*, bool*) + 270
frame #142: 0x00007f7730c90999 libcoreclr.so`ThreadpoolMgr::WorkerThreadStart(void*) + 1241
frame #143: 0x00007f7730fa371d libcoreclr.so`CorUnix::CPalThread::ThreadEntry(void*) + 349
frame #144: 0x00007f77325d96ba libpthread.so.0`start_thread + 202
frame #145: 0x00007f773186a4dd libc.so.6`__clone + 109 at clone.S:109
/home/consul/carwaleweb/libChakraCore.so
Because the libChakraCore.so
assembly is located at the root of web application, and not in the runtimes/linux-x64/native
subdirectory, I recommend that you compare this assembly with the assembly from NuGet package.
This is because it is a self-contained ready to run publish of the application. I'll still compare and let you know. Thanks.
diff
does not show any difference between the file in the nuget package and the file at /home/consul/carwaleweb/libChakraCore.so
Try deploying a web application with a assembly from the official release.
I tried deploying the file from the official release by copying the libChakraCore.so
file but was unable to run the application with that, is there anything else to be done to use the official release ?
Also I deployed the application without a self-contained build and the frequency of segfaults reduced but it still happened. Thanks.
The segfault that occurs in the regular build also gives a similar trace
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `dotnet Carwale.UI.dll'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fc60bb05cee in Memory::RecyclerWriteBarrierManager::WriteBarrier(void*) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
[Current thread is 1 (Thread 0x7fc6167fc700 (LWP 31185))]
(gdb) bt
#0 0x00007fc60bb05cee in Memory::RecyclerWriteBarrierManager::WriteBarrier(void*) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#1 0x00007fc60bc501b5 in Js::FunctionCodeGenRuntimeData::GetInlinee(unsigned short) const () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#2 0x00007fc60bb2bf7c in void Js::FunctionCodeGenRuntimeData::MapInlineCaches<void Js::FunctionBody::CleanUpInlineCaches<false>()::{lambda(Js::InlineCache*)#1}>(void Js::FunctionBody::CleanUpInlineCaches<false>()::{lambda(Js::InlineCache*)#1}) const () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#3 0x00007fc60bb28677 in void Js::FunctionBody::CleanUpInlineCaches<false>() () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#4 0x00007fc60bb1e6e8 in Js::FunctionBody::CleanupRecyclerData(bool, bool) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#5 0x00007fc60bb15a70 in Js::FunctionBody::Cleanup(bool) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#6 0x00007fc60bb1563b in Js::FunctionBody::RedeferFunction() () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#7 0x00007fc60bb30dd8 in Js::ScriptContext::RedeferFunctionBodies(BVSparse<Memory::ArenaAllocator>*, unsigned int) ()
from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#8 0x00007fc60bb48037 in ThreadContext::TryRedeferral() () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#9 0x00007fc60bb47e85 in ThreadContext::PostSweepRedeferralCallBack() () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#10 0x00007fc60bafc2f9 in Memory::Recycler::Sweep(unsigned long, bool, bool) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#11 0x00007fc60bafcefd in Memory::Recycler::DoCollect(Memory::CollectionFlags) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#12 0x00007fc60bb46bd5 in ThreadContext::ExecuteRecyclerCollectionFunction(Memory::Recycler*, int (Memory::Recycler::*)(Memory::CollectionFlags), Memory::CollectionFlags) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#13 0x00007fc60b8e18ac in _JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}::operator()() const ()
from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#14 0x00007fc60b8e173e in _JsErrorCode GlobalAPIWrapper_Core<_JsErrorCode GlobalAPIWrapper_NoRecord<_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}>(_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1})::{lambda()#1}>(_JsErrorCode JsCollectGarbageCommon<(Memory::CollectionFlags)536907776>(void*)::{lambda()#1}) () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#15 0x00007fc60b8c472d in JsCollectGarbage () from /home/consul/carwaleweb/runtimes/linux-x64/native/libChakraCore.so
#16 0x00007fc67b3a96a2 in ?? ()
#17 0x00007fc65439f728 in ?? ()
#18 0x0000000000235504 in ?? ()
#19 0x00007fc6e85ac718 in ?? () from /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.8/libcoreclr.so
Let me know how I can help debug this and provide more information. Thanks.
I am not an expert in C++ and Linux, so it is difficult for me to help you solve this problem.
I can only recommend you to try using the JavaScriptEngineSwitcher.Node module as an JS engine.
Hello, Meet!
I recommend that you try the experimental cross-platform version of the JavaScriptEngineSwitcher.V8 module.
You can also see my suggestions for improving the original ClearScript library.
Hi Taritsyn, We have already started using JavaScriptEngineSwitcher.Node in production and haven't faced any issues yet, also the latencies are comparable. I'll definitely try out the cross-platform version of JavaScriptEngineSwitcher.V8 some time later. Thanks.
Hi, I am using ReactJS.net (v5.2.5) with JavaScriptEngineSwitcher.ChakraCore (v3.7.1) in .netcore 3.1 on linux. My application terminates randomly with Segmentation fault. I don't know much about
gdb
but running basic commands on thecore
dump generated by Segmentation fault gives the following output:Please let me know if more info is needed. Or if I should be filing this issue in the ChakraCore repository.
Thankyou.