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

Cannot use vm in multiple goroutines #329

Closed
dgrr opened this issue Mar 17, 2020 · 3 comments
Closed

Cannot use vm in multiple goroutines #329

dgrr opened this issue Mar 17, 2020 · 3 comments

Comments

@dgrr
Copy link

dgrr commented Mar 17, 2020

Hello,

I am getting the following panic message:

fatal error: concurrent map read and map write

goroutine 7085 [running]:
runtime.throw(0xde958c, 0x21)
	/usr/lib/go/src/runtime/panic.go:774 +0x72 fp=0xc003366188 sp=0xc003366158 pc=0x42f902
runtime.mapaccess2_faststr(0xcbf780, 0xc00015fa70, 0xc001981430, 0x7, 0x7, 0xc90340)
	/usr/lib/go/src/runtime/map_faststr.go:116 +0x48f fp=0xc0033661f8 sp=0xc003366188 pc=0x4148bf
github.com/mattn/anko/vm.(*runInfoStruct).invokeExpr(0xc000897a00)
	/home/dgrr/.go/src/github.com/mattn/anko/vm/vmExpr.go:515 +0x32f2 fp=0xc0033669a0 sp=0xc0033661f8 pc=0x8b8652
github.com/mattn/anko/vm.(*runInfoStruct).runSingleStmt(0xc000897a00)
	/home/dgrr/.go/src/github.com/mattn/anko/vm/vmStmt.go:146 +0x2ff fp=0xc003366f40 sp=0xc0033669a0 pc=0x8cab3f
github.com/mattn/anko/vm.(*runInfoStruct).runSingleStmt(0xc000897a00)
	/home/dgrr/.go/src/github.com/mattn/anko/vm/vmStmt.go:86 +0x2faf fp=0xc0033674e0 sp=0xc003366f40 pc=0x8cd7ef
github.com/mattn/anko/vm.RunContext(0xffff60, 0xc0000d4010, 0xc0019acb70, 0x0, 0xff5fc0, 0xc0019acc30, 0xd4277fceba22319f, 0xc0019b4f20, 0xd400000000d875c0, 0xc000545401)
	/home/dgrr/.go/src/github.com/mattn/anko/vm/vmStmt.go:44 +0x134 fp=0xc0033675a0 sp=0xc0033674e0 pc=0x8ca6e4
github.com/mattn/anko/vm.Execute(0xc0019acb70, 0x0, 0xc0054a2900, 0x8e, 0xc0006e4568, 0x0, 0x0, 0x4834f1)
	/home/dgrr/.go/src/github.com/mattn/anko/vm/vmStmt.go:20 +0x168 fp=0xc003367628 sp=0xc0033675a0 pc=0x8ca558
main.(*scriptRunner).Run(0xc003cd4c90, 0xc00183114f, 0x5, 0x0, 0x0)
	/home/user/myproject/engine.go:27 +0x532 fp=0xc003367760 sp=0xc003367628 pc=0xc14822
@dgrr
Copy link
Author

dgrr commented Mar 17, 2020

The error happens when accessing to env.Packages
image

@dgrr
Copy link
Author

dgrr commented Mar 17, 2020

How can I isolate the packages by env?

@dgrr
Copy link
Author

dgrr commented Mar 17, 2020

Setting the Packages in the init function worked. image

@dgrr dgrr closed this as completed Mar 17, 2020
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