rogchap / v8go

Execute JavaScript from Go

Home Page:https://rogchap.com/v8go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

__gnu_cxx recursive init error on multiple goroutines creating isolates at the same time

saiskee opened this issue · comments

When creating new isolates in multiple goroutines at the same time, I get the following crash message:

terminate called recursively
terminate called after throwing an instance of '__gnu_cxx::recursive_init_error'
  what():  std::exception
SIGABRT: abort
PC=0x7ff2f869722d m=27 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 3463 [syscall]:
runtime.cgocall(0x773bdf0, 0xc0005b9808)
	/usr/local/go/src/runtime/cgocall.go:158 +0x5c fp=0xc0005b97e0 sp=0xc0005b97a8 pc=0x286007c
rogchap.com/v8go._Cfunc_NewIsolate()
	_cgo_gotypes.go:745 +0x49 fp=0xc0005b9808 sp=0xc0005b97e0 pc=0x73a3a89
rogchap.com/v8go.NewIsolate()
	/go/pkg/mod/rogchap.com/v8go@v0.7.1-0.20221102201510-1f00b5007d95/isolate.go:59 +0x39 fp=0xc0005b9858 sp=0x
c0005b9808 pc=0x73acb59
github.com/solo-io/gloo-mesh-enterprise/pkg/translator/plugins/graphql.NewStitchingScriptRunner()

I've tried to do a little testing myself and believe that multiple goroutines are hanging on this line: https://github.com/rogchap/v8go/blob/master/v8go.cc#L154

Why version of this package are you using? I am on v0.7.0 and I can create a new isolate per http request (which runs on its own goroutine)