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

Running new Array(100).fill() result in JS_FreeRuntime: Assertion `list_empty(&rt->gc_obj_list)' failed. #365

Open
0xB1a60 opened this issue Jan 11, 2025 · 0 comments

Comments

@0xB1a60
Copy link

0xB1a60 commented Jan 11, 2025

Hello,

I was testing the memory limit logic and I hit the following case:

Go code:

package main

import (
	"github.com/buke/quickjs-go"
)

func main() {
	// Create a new runtime
	rt := quickjs.NewRuntime(
		quickjs.WithExecuteTimeout(30),
		quickjs.WithMemoryLimit(128*1024),
		quickjs.WithGCThreshold(256*1024),
		quickjs.WithMaxStackSize(65534),
		quickjs.WithCanBlock(false),
	)
	defer rt.Close()

	// Create a new context
	ctx := rt.NewContext()
	defer ctx.Close()

	_, err := ctx.Eval(`new Array(100).fill("memory hog")`)
	if err != nil {
		panic(err.Error())
	}
}

Error:

___go_build_awesomeProject20: quickjs.c:1998: JS_FreeRuntime: Assertion `list_empty(&rt->gc_obj_list)' failed.
SIGABRT: abort
PC=0x7f33500969fc m=0 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 1 gp=0xc0000061c0 m=0 mp=0x619b20 [syscall, locked to thread]:
runtime.cgocall(0x480bd0, 0xc000069de0)
	/snap/go/current/src/runtime/cgocall.go:167 +0x4b fp=0xc000069db8 sp=0xc000069d80 pc=0x4636ab
github.com/buke/quickjs-go._Cfunc_JS_FreeRuntime(0xc9c050)
	_cgo_gotypes.go:459 +0x3f fp=0xc000069de0 sp=0xc000069db8 pc=0x47b2bf
main.main.deferwrap1.Runtime.Close.1({0x47fa45?, 0xc0000200f0?})
	/home/myuser/go/pkg/mod/github.com/buke/[email protected]/runtime.go:114 +0x45 fp=0xc000069e20 sp=0xc000069de0 pc=0x47fb25
github.com/buke/quickjs-go.Runtime.Close(...)
	/home/myuser/go/pkg/mod/github.com/buke/[email protected]/runtime.go:114
main.main.deferwrap1()
	/home/myuser/GolandProjects/awesomeProject20/main.go:16 +0x25 fp=0xc000069e40 sp=0xc000069e20 pc=0x47faa5
main.main()
	/home/myuser/GolandProjects/awesomeProject20/main.go:26 +0x1a3 fp=0xc000069f50 sp=0xc000069e40 pc=0x47f9c3
runtime.main()
	/snap/go/current/src/runtime/proc.go:272 +0x28b fp=0xc000069fe0 sp=0xc000069f50 pc=0x4380cb
runtime.goexit({})
	/snap/go/current/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000069fe8 sp=0xc000069fe0 pc=0x46e141

goroutine 2 gp=0xc000006c40 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/snap/go/current/src/runtime/proc.go:424 +0xce fp=0xc000052fa8 sp=0xc000052f88 pc=0x46790e
runtime.goparkunlock(...)
	/snap/go/current/src/runtime/proc.go:430
runtime.forcegchelper()
	/snap/go/current/src/runtime/proc.go:337 +0xb3 fp=0xc000052fe0 sp=0xc000052fa8 pc=0x438413
runtime.goexit({})
	/snap/go/current/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x46e141
created by runtime.init.7 in goroutine 1
	/snap/go/current/src/runtime/proc.go:325 +0x1a

goroutine 3 gp=0xc000007180 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/snap/go/current/src/runtime/proc.go:424 +0xce fp=0xc000053780 sp=0xc000053760 pc=0x46790e
runtime.goparkunlock(...)
	/snap/go/current/src/runtime/proc.go:430
runtime.bgsweep(0xc000080000)
	/snap/go/current/src/runtime/mgcsweep.go:277 +0x94 fp=0xc0000537c8 sp=0xc000053780 pc=0x423d94
runtime.gcenable.gowrap1()
	/snap/go/current/src/runtime/mgc.go:204 +0x25 fp=0xc0000537e0 sp=0xc0000537c8 pc=0x418705
runtime.goexit({})
	/snap/go/current/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000537e8 sp=0xc0000537e0 pc=0x46e141
created by runtime.gcenable in goroutine 1
	/snap/go/current/src/runtime/mgc.go:204 +0x66

goroutine 4 gp=0xc000007340 m=nil [GC scavenge wait]:
runtime.gopark(0xc000080000?, 0x570250?, 0x1?, 0x0?, 0xc000007340?)
	/snap/go/current/src/runtime/proc.go:424 +0xce fp=0xc000053f78 sp=0xc000053f58 pc=0x46790e
runtime.goparkunlock(...)
	/snap/go/current/src/runtime/proc.go:430
runtime.(*scavengerState).park(0x618d60)
	/snap/go/current/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000053fa8 sp=0xc000053f78 pc=0x4217c9
runtime.bgscavenge(0xc000080000)
	/snap/go/current/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000053fc8 sp=0xc000053fa8 pc=0x421d3c
runtime.gcenable.gowrap2()
	/snap/go/current/src/runtime/mgc.go:205 +0x25 fp=0xc000053fe0 sp=0xc000053fc8 pc=0x4186a5
runtime.goexit({})
	/snap/go/current/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x46e141
created by runtime.gcenable in goroutine 1
	/snap/go/current/src/runtime/mgc.go:205 +0xa5

goroutine 5 gp=0xc000007c00 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/snap/go/current/src/runtime/proc.go:424 +0xce fp=0xc000054620 sp=0xc000054600 pc=0x46790e
runtime.runfinq()
	/snap/go/current/src/runtime/mfinal.go:193 +0x107 fp=0xc0000547e0 sp=0xc000054620 pc=0x417787
runtime.goexit({})
	/snap/go/current/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000547e8 sp=0xc0000547e0 pc=0x46e141
created by runtime.createfing in goroutine 1
	/snap/go/current/src/runtime/mfinal.go:163 +0x3d

rax    0x0
rbx    0x7f33503f7740
rcx    0x7f33500969fc
rdx    0x6
rdi    0x5bdd
rsi    0x5bdd
rbp    0x5bdd
rsp    0x7ffe86e3e750
r8     0x7ffe86e3e820
r9     0xa2e64656c6961
r10    0x8
r11    0x246
r12    0x6
r13    0x16
r14    0x57637b
r15    0xc9c050
rip    0x7f33500969fc
rflags 0x246
cs     0x33
fs     0x0
gs     0x0
uname -a
Linux my-desktop 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
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

1 participant