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
race condition in gopher-lua: fatal error: concurrent map writes #7
Comments
Added commit e89ea7e that might perhaps fix this. Please confirm that it works now. If not, please add steps to reproduce the issue and I'll look into it. Thanks! |
@xyproto here is how i can produce this. server.lua: h = function()
print("Hello, world!")
end
handle("/", h) algernon --server --nolimit --addr=:3001 server.lua using ab to do some concurrent requests: ab -c 10 -n 10000 http://127.0.0.1:3001/ |
Perfect, thanks! I'm able to reproduce the issue. Will fix. |
Added a mutex. Using channels somehow might be more elegant, but this should fix the issue for now. Please confirm that it now works as expected. |
yes, the runtime issue is fixed, but the mutex is unfortunate and will hinder throughput, but at least it works now. :-D |
Moved the mutex so that it is only locking when exporting common Lua functions to the Lua state object, not when actually executing the Lua function. I think this should improve the speed, and all tests (and the benchmarking script) all pass. |
it seems like maybe the lua function "handle" is missing locking, or doesn't use a seperate lua instance from the state cache.
The text was updated successfully, but these errors were encountered: