Crash in creating isolate.

614 views
Skip to first unread message

Jane Chen

unread,
Oct 2, 2015, 9:27:59 PM10/2/15
to v8-users
I'm using v8 version 4.7 on Linux 64 debug.  hello-world and shell both work fine.  But v8 in my embedding application crashes at Isolate::New:

12 v8::base::OS::Abort() /space/projects/v8-git/v8/src/base/platform/platform-posix.cc:229 0x00007ffff6567a41   
11 V8_Fatal() /space/projects/v8-git/v8/src/base/logging.cc:116 0x00007ffff6562631   
10 v8::internal::NativesHolder<(v8::internal::NativeType)0>::get() /space/projects/v8-git/v8/src/snapshot/natives-external.cc:128 0x00007ffff65693df   
9 v8::internal::NativesCollection<(v8::internal::NativeType)0>::GetBuiltinsCount() /space/projects/v8-git/v8/src/snapshot/natives-external.cc:206 0x00007ffff6569379   
8 v8::internal::Heap::CreateInitialObjects() /space/projects/v8-git/v8/src/heap/heap.cc:2662 0x00007ffff603ef05   
7 v8::internal::Heap::CreateHeapObjects() /space/projects/v8-git/v8/src/heap/heap.cc:5103 0x00007ffff604b01c   
6 v8::internal::Isolate::Init() /space/projects/v8-git/v8/src/isolate.cc:2144 0x00007ffff61a7055   
5 v8::Isolate::New() /space/projects/v8-git/v8/src/api.cc:7103 0x00007ffff5c5914f   

I've already reduced my test code to be as close to hello-world's example as possible:

  v8::V8::InitializeICU();
  v8::V8::InitializeExternalStartupData(Server::getInstallDir().c_str());
  v8::Platform* platform = v8::platform::CreateDefaultPlatform();
  v8::V8::InitializePlatform(platform);
  v8::V8::Initialize();
  JSArrayBufferAllocator alloc;
  v8::Isolate::CreateParams createParams;
  createParams.array_buffer_allocator = &alloc;
  v8::Isolate* isolate = v8::Isolate::New(createParams);

I've also made sure natives_blob.bin and snapshot_blob.bin are present at my install directory.  And tried building and running with static libraries.  Also tried building and running with no snapshots.  Nothing helped.

I found this:
https://code.google.com/p/v8/issues/detail?id=4192

Seems to be same stack but different program.  I can't reproduce it with hello-world.

Any help would be really appreciated.

Ben Noordhuis

unread,
Oct 3, 2015, 12:30:55 PM10/3/15
to v8-u...@googlegroups.com
I commented on the issue. Can you check if `make
GYPFLAGS="-Dv8_use_external_startup_data=0"` works for you?

Jane Chen

unread,
Oct 3, 2015, 9:24:20 PM10/3/15
to v8-users
Ben,

That did it!  Thank you so much!

When I build v8 that way, I don't get libv8.so even though I have "library=shared".  Neither do I get libv8_external_snapshot.a.  So the crash must have to do with external snapshots?  Is there anyway to get libv8.so in this mode?  You don't expect any negative performance impact in this mode, do you?

Thanks again!

Jane

Jane Chen

unread,
Oct 4, 2015, 3:28:15 AM10/4/15
to v8-users
I managed to get shared library with -Dcomponent=shared_library.  So now just wondering what it means to have v8_use_external_startup_data=0.

Thanks.

Ben Noordhuis

unread,
Oct 4, 2015, 6:52:33 AM10/4/15
to v8-u...@googlegroups.com
On Sun, Oct 4, 2015 at 9:28 AM, Jane Chen <jxch...@gmail.com> wrote:
> I managed to get shared library with -Dcomponent=shared_library. So now
> just wondering what it means to have v8_use_external_startup_data=0.

It bakes the snapshot blobs into the library. With
v8_use_external_startup_data=1, you get a couple of *.bin files in
out/ that you need to copy over.

Chia-Wen Ho

unread,
Oct 5, 2015, 4:21:51 AM10/5/15
to v8-users
I tried to update v8 from 3.25 to 4.5 and got this error. Then I use "snapshot=off".
My question is: Is the snapshot by default built into the binary in older v8 version (ex. 3.25)? 
If yes, I should use "-Dv8_use_external_startup_data=0" instead of "snapshot=off" to have the consistent behavior like the old version, right?
Thanks.

Jane Chen

unread,
Oct 5, 2015, 12:11:57 PM10/5/15
to v8-users
I believe turning snapshot off has a performance impact.  So the gyp flag  "-Dv8_use_external_startup_data=0" is probably preferable. 

I'm still curious why hello-world and shell are able to pick up the external snapshots, but not my embedding application.  Is the need of this workaround a bug?
Reply all
Reply to author
Forward
0 new messages