mattn / anko

Scriptable interpreter written in golang
http://play-anko.appspot.com/
MIT License
1.47k stars 118 forks source link

Data race when running scripts concurrently #358

Open brutella opened 11 months ago

brutella commented 11 months ago

When I run multiple scripts concurrently, I get a data race when the global variables Packages and PackageTypes are accessed here and here.

I add and remove packages from env.Packages and env.PackageTypes before a script is executed. That's why I get a data race because the access to those global variables is not synchronised. I was able to fix this issue by allowing packages to be defined on an environment level – see pull request below.

Might be related to #34

mattn commented 11 months ago

Thanks. Could you please add tests?

brutella commented 11 months ago

Done

brutella commented 10 months ago

@mattn Any chance to get this merged?