net.box: fix hang in graceful shutdown protocol
The graceful shutdown protocol works as follows: 1. The server sends a shutdown request (the box.shutdown event) to all its clients that subscribed to it. 2. Upon receiving a shutdown request, a client is supposed to close its connection. 3. The server waits for all clients subscribed to box.shutdown event to exit. 4. The server exits. In net.box, the box.shutdown event is processed by `remote._callback`. The problem is it may occur that `remote._callback` is garbage collected while the `remote` object isn't. If this happens, the shutdown request will never get processed, and the server won't exit until the `remote` object is garbage collected, which may take forever. Let's fix this issue by breaking the worker loop if we see that the callback was garbage collected. Closes #7225 NO_DOC=bug fix
Showing
- changelogs/unreleased/gh-7225-net-box-graceful-shutdown-hang.md 5 additions, 0 deletions...logs/unreleased/gh-7225-net-box-graceful-shutdown-hang.md
- src/box/lua/net_box.lua 8 additions, 0 deletionssrc/box/lua/net_box.lua
- test/box-luatest/graceful_shutdown_test.lua 18 additions, 0 deletionstest/box-luatest/graceful_shutdown_test.lua
- test/box-luatest/net_box_test.lua 22 additions, 0 deletionstest/box-luatest/net_box_test.lua
Loading
Please register or sign in to comment