Closed s00500 closed 12 months ago
concurrent map write
indicates two or more goroutines we're trying to access the map at the same time.
The crash should have had multiple stacks should indicate why.
The application this runs in is pretty big. Searching to the go routine dump I found this second occasion where a function using the otto package is used
reactor/dispatch.(Script).setUpVMFunctions.func2({0x400649db00, 0x0, 0x0, {0x5, {0x148ad20, 0x40025cc120}}, {0x400499e270, 0x1, 0x1}, 0x40049f3200}) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_expression.go:239 +0x31c github.com/robertkrimen/otto@v0.2.1/type_function.go:200 +0x5c8 reactor/dispatch/DScripts.go:125 +0xdc github.com/robertkrimen/otto.(_object).call(0x40012571a0, {0xd92f0?, {0x148ad20?, 0x40025cc120?}}, {0x400499e270?, 0x1, 0x1}, 0x60?, {0x0, {0x0, ...}, ...}) github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeCallExpression(0x400649db00, 0x400499c750, {0x0, 0x0, 0x0}) github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeExpression(0x400649db00, {0x6b5e980?, 0x400499c750}) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_expression.go:43 +0x154 github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeAssignExpression(0x48?, 0x400499c780) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_expression.go:121 +0x5c github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeExpression(0x400649db00, {0x6b5e8e0?, 0x400499c780}) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_expression.go:30 +0xc0 github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_statement.go:398 +0x20c github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_statement.go:61 +0x3e8 github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatement(0x400649db00, {0x6b5ea40?, 0x400435acf0}) github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatement(0x400649db00, {0x6b5ecc0?, 0x400499c720}) github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeWhileStatement(0x400649db00, 0x400499c6f0?) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_statement.go:107 +0x838 github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatementList(0x400649db00?, {0x4004980150?, 0x7, 0x297?}) github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate_statement.go:119 +0x90 github.com/robertkrimen/otto@v0.2.1/cmpl_evaluate.go:17 +0x160 github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeProgram(0x400649db00, 0x40049801c0, 0x0) github.com/robertkrimen/otto@v0.2.1/error.go:255 +0x58 github.com/robertkrimen/otto@v0.2.1/runtime.go:838 +0x8c github.com/robertkrimen/otto@v0.2.1/runtime.go:839 +0x30 github.com/robertkrimen/otto.(_runtime).cmpl_runOrEval(0x400649db00, {0x131c660?, 0x400435aaa0?}, {0x0?, 0x0?}, 0x0) github.com/robertkrimen/otto.(_runtime).cmpl_runOrEval.func1() github.com/robertkrimen/otto.catchPanic(0x4000687e68?) github.com/robertkrimen/otto@v0.2.1/runtime.go:851 github.com/robertkrimen/otto.(_runtime).cmpl_run(...) github.com/robertkrimen/otto.Otto.Run({0x4001257020?, 0x400649db00?}, {0x131c660?, 0x400435aaa0?}) github.com/robertkrimen/otto@v0.2.1/otto.go:293 +0x44 reactor/dispatch.(Script).runScript(0x4000a83680) reactor/dispatch/DScripts.go:218 +0x1a0 reactor/dispatch/DScripts.go:276 +0x17c created by reactor/dispatch.(Script).ManageState
Sounds like your dispatch could be reusing a VM for multiple requests? If this is case you need to lock it to prevent concurrent access.
Uff, just found that the mutex supposed to protect the structure holding the vm is never used.... not my code... but should have checked closer first.... sorry for opening this issue...
Glad the pointers helped
I got a pretty strange crash today...
Notice that this is the first time I have seen this:
Any idea what could have caused this exactly ?
Could this change be related: https://github.com/robertkrimen/otto/commit/fc4074c6167d94ae06b7f48f62256973254c6b66 ?
Greetings, Lukas