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

Segfault when creating snapshot #43

Open
jacksontj opened this issue Mar 5, 2019 · 2 comments
Open

Segfault when creating snapshot #43

jacksontj opened this issue Mar 5, 2019 · 2 comments

Comments

@jacksontj
Copy link
Collaborator

First off, thanks for the library-- its nice to find language bindings that already exist.

I've been toying around with it, and I've got most things working, but I seem to occasionally run into issues which cause segfaults. The main one I'm hitting now is around snapshots. I have been unable to reproduce it with a trivial example (I'm continuing to try, but figured I'd open the issue in case its already known). I have a JS file (its a webpack compiled js file of a react app), and when I Eval() it in a normal context all is well, but if I instead attempt to create a snapshot out of it -- I get the following segfault:

(gdb) bt full
#0  runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:146
No locals.
#1  0x00000000007b7b9b in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:424
No locals.
#2  0x00000000007b8138 in runtime.sigfwdgo (ctx=0xc00055f9c0, info=0xc00055faf0, sig=6, ~r3=<optimized out>) at /usr/local/go/src/runtime/signal_unix.go:629
        flags = <optimized out>
        fwdFn = <optimized out>
        g = <optimized out>
#3  0x00000000007b73f8 in runtime.sigtrampgo (ctx=0xc00055f9c0, info=0xc00055faf0, sig=<optimized out>) at /usr/local/go/src/runtime/signal_unix.go:289
        g = <optimized out>
        gsignalStack = <optimized out>
        setStack = <optimized out>
        sp = <optimized out>
#4  0x00000000007d3913 in runtime.sigtramp () at /usr/local/go/src/runtime/sys_linux_amd64.s:353
No locals.
#5  <signal handler called>
No locals.
#6  runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:146
No locals.
#7  0x00000000007b7b9b in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:424
No locals.
#8  0x00000000007b7d5a in runtime.crash () at /usr/local/go/src/runtime/signal_unix.go:518
No locals.
#9  0x00000000007ce6e4 in runtime.fatalthrow.func1 () at /usr/local/go/src/runtime/panic.go:667
        gp = 0xc00013ec00
        pc = 8003906
        sp = 140298839633024
#10 0x00000000007a2307 in runtime.fatalthrow () at /usr/local/go/src/runtime/panic.go:660
        gp = <optimized out>
        pc = <optimized out>
        sp = <optimized out>
#11 0x00000000007a2142 in runtime.throw (s=...) at /usr/local/go/src/runtime/panic.go:608
        gp = <optimized out>
#12 0x00000000007b7b52 in runtime.sigpanic () at /usr/local/go/src/runtime/signal_unix.go:374
        g = <optimized out>
---Type <return> to continue, or q <return> to quit--- 
#13 0x0000000000e064d5 in v8::internal::PartialSerializer::SerializeEmbedderFields() ()
No symbol table info available.
#14 0x0000000000e06bc4 in v8::internal::PartialSerializer::Serialize(v8::internal::Object**, bool) ()
No symbol table info available.
#15 0x0000000000adfd18 in v8::SnapshotCreator::CreateBlob(v8::SnapshotCreator::FunctionCodeHandling) ()
No symbol table info available.
#16 0x0000000000ae03d1 in v8::V8::CreateSnapshotDataBlob(char const*) ()
No symbol table info available.
#17 0x0000000000aa7919 in v8_CreateSnapshotDataBlob (js=<optimized out>) at v8_c_bridge.cc:181
        data = <optimized out>
#18 0x0000000000aa59cd in _cgo_8127a7a1550c_Cfunc_v8_CreateSnapshotDataBlob (v=0xc00008da00) at cgo-gcc-prolog:145
        _cgo_a = 0xc00008da00
        _cgo_stktop = 0xc00008e000 ""
        _cgo_r = <optimized out>
#19 0x00000000007d14b0 in runtime.asmcgocall () at /usr/local/go/src/runtime/asm_amd64.s:637
No locals.
#20 0x00007f9a04a62188 in ?? ()
No symbol table info available.
#21 0x00007f99de7fbe28 in ?? ()
No symbol table info available.
#22 0x00000000007cdc43 in runtime.mProf_Malloc.func1 () at /usr/local/go/src/runtime/mprof.go:357
        b = 0x0
        p = 0x7d3624 <runtime.raise+20>
#23 0x000000c00011e480 in ?? ()
No symbol table info available.
#24 0x00000000007a6a30 in ?? () at /usr/local/go/src/runtime/proc.go:1146
No locals.
#25 0x0000000000000000 in ?? ()
No symbol table info available.

Any pointers for debugging this? It (1) seems odd that Eval and Snapshot would give different behavior for the same string (no go injected values etc.) (2) this seems like something that the bindings should return as an error instead of a panic -- right now the CreateSnapshot() method doesn't return an error which is odd.

@augustoroman
Copy link
Owner

Check to see if #45 fixed your problem. Apparently there was an issue around snapshots getting GC'd after the isolate was running.

@jacksontj
Copy link
Collaborator Author

Unfortunately it doesn't seem to have helped :/ I'm still getting a panic in v8.

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