After fixing the issue about the handle scope, I can successfully create the snapshot for the test code, but when I tried something more complicated, I ran into this now:
Check failed: 0 == isolate->global_handles()->global_handles_count() (0 vs. 4). On Wednesday, September 6, 2017 at 12:27:35 PM UTC-4, Zac Hansen wrote: > > > https://v8.paulfryzel.com/docs/master/classv8_1_1_snapshot_creator.html#a86b2023acdb88a9bd6eae2695f2b0a8a > > Created a snapshot data blob. This must not be called from within a handle > scope. > > > > > On Wednesday, September 6, 2017 at 7:20:33 AM UTC-7, Francisco Moraes > wrote: >> >> Here's a simple recreate that I managed to create: >> >> #include <string.h> >> >> #include "v8.h" >> #include "libplatform/libplatform.h" >> >> int main(int argv, char **argc) >> { >> const char *v8flags = ""; >> v8::Platform *platform = v8::platform::CreateDefaultPlatform(); >> v8::V8::SetFlagsFromString (v8flags, strlen (v8flags)); >> v8::V8::InitializePlatform(platform); >> v8::V8::Initialize(); >> >> v8::SnapshotCreator creator; >> v8::Isolate *isolate = creator.GetIsolate(); >> >> v8::HandleScope handle_scope(isolate); >> v8::Local<v8::Context> context = v8::Context::New(isolate); >> const char* source = "function initialize(obj) { return true; }"; >> v8::Context::Scope context_scope(context); >> v8::TryCatch try_catch(isolate); >> v8::Local<v8::String> source_string; >> v8::String::NewFromUtf8(isolate, source, v8::NewStringType::kNormal) >> .ToLocal(&source_string); >> v8::ScriptOrigin origin = >> v8::ScriptOrigin(v8::String::NewFromUtf8(isolate, "testscript")); >> v8::ScriptCompiler::Source sourcecode(source_string, origin); >> v8::Local<v8::Script> script; >> bool success = v8::ScriptCompiler::Compile(context, >> &sourcecode).ToLocal(&script); >> >> script->Run(context); >> >> creator.SetDefaultContext(context); >> v8::StartupData blob = >> creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); >> >> return 1; >> } >> >> The interesting thing is if I call v8::V8::CreateSnapshotDataBlob it >> works as it does all the above work for me, so something in trying to use >> the SnapshotCreator is causing me some issue as I will need to handle >> custom embedder fields, etc... >> >> On Tuesday, September 5, 2017 at 2:50:36 PM UTC-4, Zac Hansen wrote: >>> >>> That kind of error usually means you either haven't created a context or >>> aren't in a context or haven't created an appropriate handle. Or... >>> Something else :-/. Maybe a lock? V8 errors are very much a "you screwed >>> up somewhere" notification and often nothing more >>> >>> On Tue, Sep 5, 2017 at 9:42 AM Francisco Moraes <francisc...@gmail.com> >>> wrote: >>> >>>> I will give it a try sometime this week. I tried to remove our >>>> initialization JS file but that caused a failure further down the >>>> serialization as well, so still investigating. >>>> >>>> >>>> On Saturday, September 2, 2017 at 1:07:28 AM UTC-4, Zac Hansen wrote: >>>>> >>>>> Can you post a minimal complete example that reproduces your problem? >>>>> >>>>> On Friday, September 1, 2017 at 8:57:51 AM UTC-7, Francisco Moraes >>>>> wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>> I am trying to create a snapshot that includes most of code but I ran >>>>>> into the following assertion: >>>>>> >>>>>> CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); >>>>>> >>>>>> Any clarifications about what would generate it that our JS code is >>>>>> doing and is not legal? I found that creating Unsafe Arrays is also not >>>>>> permitted but that is relatively easy to work around. >>>>>> >>>>>> Francisco >>>>>> >>>>> -- >>>> -- >>>> v8-users mailing list >>>> v8-u...@googlegroups.com >>>> http://groups.google.com/group/v8-users >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "v8-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/v8-users/kxtnaSSQL9c/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> v8-users+u...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >> On Tuesday, September 5, 2017 at 2:50:36 PM UTC-4, Zac Hansen wrote: >>> >>> That kind of error usually means you either haven't created a context or >>> aren't in a context or haven't created an appropriate handle. Or... >>> Something else :-/. Maybe a lock? V8 errors are very much a "you screwed >>> up somewhere" notification and often nothing more >>> >>> On Tue, Sep 5, 2017 at 9:42 AM Francisco Moraes <francisc...@gmail.com> >>> wrote: >>> >>>> I will give it a try sometime this week. I tried to remove our >>>> initialization JS file but that caused a failure further down the >>>> serialization as well, so still investigating. >>>> >>>> >>>> On Saturday, September 2, 2017 at 1:07:28 AM UTC-4, Zac Hansen wrote: >>>>> >>>>> Can you post a minimal complete example that reproduces your problem? >>>>> >>>>> On Friday, September 1, 2017 at 8:57:51 AM UTC-7, Francisco Moraes >>>>> wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>> I am trying to create a snapshot that includes most of code but I ran >>>>>> into the following assertion: >>>>>> >>>>>> CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); >>>>>> >>>>>> Any clarifications about what would generate it that our JS code is >>>>>> doing and is not legal? I found that creating Unsafe Arrays is also not >>>>>> permitted but that is relatively easy to work around. >>>>>> >>>>>> Francisco >>>>>> >>>>> -- >>>> -- >>>> v8-users mailing list >>>> v8-u...@googlegroups.com >>>> http://groups.google.com/group/v8-users >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "v8-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/v8-users/kxtnaSSQL9c/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> v8-users+u...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >> On Tuesday, September 5, 2017 at 2:50:36 PM UTC-4, Zac Hansen wrote: >>> >>> That kind of error usually means you either haven't created a context or >>> aren't in a context or haven't created an appropriate handle. Or... >>> Something else :-/. Maybe a lock? V8 errors are very much a "you screwed >>> up somewhere" notification and often nothing more >>> >>> On Tue, Sep 5, 2017 at 9:42 AM Francisco Moraes <francisc...@gmail.com> >>> wrote: >>> >>>> I will give it a try sometime this week. I tried to remove our >>>> initialization JS file but that caused a failure further down the >>>> serialization as well, so still investigating. >>>> >>>> >>>> On Saturday, September 2, 2017 at 1:07:28 AM UTC-4, Zac Hansen wrote: >>>>> >>>>> Can you post a minimal complete example that reproduces your problem? >>>>> >>>>> On Friday, September 1, 2017 at 8:57:51 AM UTC-7, Francisco Moraes >>>>> wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>> I am trying to create a snapshot that includes most of code but I ran >>>>>> into the following assertion: >>>>>> >>>>>> CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); >>>>>> >>>>>> Any clarifications about what would generate it that our JS code is >>>>>> doing and is not legal? I found that creating Unsafe Arrays is also not >>>>>> permitted but that is relatively easy to work around. >>>>>> >>>>>> Francisco >>>>>> >>>>> -- >>>> -- >>>> v8-users mailing list >>>> v8-u...@googlegroups.com >>>> http://groups.google.com/group/v8-users >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "v8-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/v8-users/kxtnaSSQL9c/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> v8-users+u...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.