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

Race condition running init.lua #53

Closed
kostja opened this issue Oct 7, 2013 · 0 comments
Closed

Race condition running init.lua #53

kostja opened this issue Oct 7, 2013 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kostja
Copy link
Contributor

kostja commented Oct 7, 2013

init.lua is executed before the server binds to primary/secondary ports, but can insert data, create connections, etc. - in other words, requires a running event loop.

In fact there is no running event loop, and first and any yield in init.lua script takes it off execution and the script is only resumed after general loading is complete, as part of the main server loop.

This creates ugly race conditions, when parts of init.lua are executed concurrently with insert/update/delete requests on the server port.

How to repeat:

add box.fiber.sleep(10000) into init.lua and observe the server doesn't sleep,
but starts and runs

Or:
add box.fiber.sleep() followed by box.insert(), and observe that at start
there is no tuple inserted into the space, i.e. init.lua is not finished before the main loop begins.

How to fix:

In tarantool_lua_load_init_script run the event loop until the init script completes. Then break the loop, finish bootstrap and resume the loop.

@ghost ghost assigned rtsisyk Oct 7, 2013
llelik8 pushed a commit that referenced this issue Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants