Skip to content
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

createSnapShotToFile() assertion failure "no active GCScope" #1542

Open
hopestar90 opened this issue Oct 15, 2024 · 3 comments
Open

createSnapShotToFile() assertion failure "no active GCScope" #1542

hopestar90 opened this issue Oct 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hopestar90
Copy link

hopestar90 commented Oct 15, 2024

When I try to call the Class 'IdentifierTable' method StringView getStringViewForDev(Runtime &runtime, SymbolID id) const;
I pass the SymbolID to the function StringView getStringViewForDev(Runtime &runtime, SymbolID id) const, the I got the crash
assert(topGCScope_ && "no active GCScope");

this is the crash stack trace:

#0	0x00000001828a6a60 in __pthread_kill ()
#1	0x0000000101ababe8 in pthread_kill ()
#2	0x00000001827eba30 in abort ()
#3	0x00000001827ead20 in __assert_rtn ()
#4	0x000000010003850c in hermes::vm::HandleRootOwner::newPinnedHermesValue(hermes::vm::HermesValue) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/include/hermes/VM/HandleRootOwner-inline.h:102
#5	0x0000000100038464 in hermes::vm::HandleBase::HandleBase(hermes::vm::HandleRootOwner&, hermes::vm::HermesValue) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/include/hermes/VM/Handle-inline.h:37
#6	0x000000010004e24c in hermes::vm::Handle<hermes::vm::StringPrimitive>::Handle(hermes::vm::HandleRootOwner&, hermes::vm::StringPrimitive*) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/include/hermes/VM/Handle.h:317
#7	0x000000010001f4bc in hermes::vm::Handle<hermes::vm::StringPrimitive>::Handle(hermes::vm::HandleRootOwner&, hermes::vm::StringPrimitive*) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/include/hermes/VM/Handle.h:317
#8	0x0000000100125b40 in hermes::vm::IdentifierTable::getStringView(hermes::vm::Runtime&, hermes::vm::SymbolID) const at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/IdentifierTable.cpp:118
#9	0x0000000100125fa0 in hermes::vm::IdentifierTable::getStringViewForDev(hermes::vm::Runtime&, hermes::vm::SymbolID) const at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/IdentifierTable.cpp:144
#10	0x00000001000d0d34 in hermes::vm::getCallFrameInfo(hermes::vm::CodeBlock const*, hermes::vm::Runtime&, hermes::inst::Inst const*) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/GCBase.cpp:492
#11	0x00000001000e7f08 in hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1::operator()(hermes::vm::GCCell*) const at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/GCBase.cpp:609
#12	0x00000001000e7d58 in decltype(std::declval<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1&>()(std::declval<hermes::vm::GCCell*>())) std::__1::__invoke[abi:v160006]<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1&, hermes::vm::GCCell*>(hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1&, hermes::vm::GCCell*&&) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/invoke.h:394
#13	0x00000001000e7d04 in void std::__1::__invoke_void_return_wrapper<void, true>::__call<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1&, hermes::vm::GCCell*>(hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1&, hermes::vm::GCCell*&&) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/invoke.h:487
#14	0x00000001000e7cd8 in std::__1::__function::__alloc_func<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1, std::__1::allocator<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1>, void (hermes::vm::GCCell*)>::operator()[abi:v160006](hermes::vm::GCCell*&&) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/function.h:185
#15	0x00000001000e6d74 in std::__1::__function::__func<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1, std::__1::allocator<hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&)::$_1>, void (hermes::vm::GCCell*)>::operator()(hermes::vm::GCCell*&&) at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/function.h:356
#16	0x000000010038fff8 in std::__1::__function::__value_func<void (hermes::vm::GCCell*)>::operator()[abi:v160006](hermes::vm::GCCell*&&) const at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/function.h:510
#17	0x000000010038ffa0 in std::__1::function<void (hermes::vm::GCCell*)>::operator()(hermes::vm::GCCell*) const at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/function.h:1156
#18	0x0000000100374800 in void hermes::vm::HadesGC::HeapSegment::forAllObjs<std::__1::function<void (hermes::vm::GCCell*)>>(std::__1::function<void (hermes::vm::GCCell*)>) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/gcs/HadesGC.cpp:199
#19	0x000000010036e74c in hermes::vm::HadesGC::forAllObjs(std::__1::function<void (hermes::vm::GCCell*)> const&) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/gcs/HadesGC.cpp:2142
#20	0x00000001000d102c in hermes::vm::GCBase::createSnapshot(hermes::vm::HadesGC&, llvh::raw_ostream&) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/GCBase.cpp:620
#21	0x000000010036e9dc in hermes::vm::HadesGC::createSnapshot(llvh::raw_ostream&) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/gcs/HadesGC.cpp:1383
#22	0x000000010002807c in facebook::hermes::HermesRuntimeImpl::createSnapshotToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/API/hermes/hermes.cpp:486

May I know how to fix it, thanks a lot~

@hopestar90 hopestar90 added the bug Something isn't working label Oct 15, 2024
@tmikov
Copy link
Contributor

tmikov commented Oct 15, 2024

So, to clarify, you are getting this assertion error when you call jsi::Instrumentation::createSnapShotToFile(). Which version of Hermes is this?

@tmikov tmikov changed the title When I call the Class 'IdentifierTable' method StringView getStringViewForDev(Runtime &runtime, SymbolID id) const; I face the assert crash jsi::Instrumentation::createSnapShotToFile() causes an assertion failure "no active GCScope" Oct 15, 2024
@tmikov tmikov changed the title jsi::Instrumentation::createSnapShotToFile() causes an assertion failure "no active GCScope" createSnapShotToFile() assertion failure "no active GCScope" Oct 15, 2024
@hopestar90
Copy link
Author

So, to clarify, you are getting this assertion error when you call jsi::Instrumentation::createSnapShotToFile(). Which version of Hermes is this?

this Hermes version is based on the branch rn/0.71-stable

@neildhar
Copy link
Contributor

@hopestar90 Have you modified the Hermes source that you are using? In your stack trace GCBase::createSnapshot appears to be calling:

0x00000001000d0d34 in hermes::vm::getCallFrameInfo(hermes::vm::CodeBlock const*, hermes::vm::Runtime&, hermes::inst::Inst const*) at /Users/victor.chi/github_hermes_workspace/shopee-hermes/lib/VM/GCBase.cpp:492

But I don't see any such function in rn/0.71-stable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants