net.box: explicitly forbid synchronous requests in triggers #7293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Net.box triggers (
on_connect
,on_schema_reload
) are executed by the net.box connection worker fiber so a request issued by a trigger callback can't be processed until the trigger returns execution to the net.box fiber. Currently, an attempt to issue a synchronous request from a net.box trigger leads to a silent hang of the connection, which is confusing. Let's instead raise an error until #7291 is implemented.We need to add the check to three places in the code:
luaT_netbox_wait_result
forfuture:wait_result()
luaT_netbox_iterator_next
forfuture:pairs()
conn._request
for all synchronous requests.(We can't add the check to
luaT_netbox_transport_perform_request
, becauseconn._request
may also callconn.wait_state
, which would hang if called fromon_connect
oron_schema_reload
trigger.)We also add an assertion to
netbox_request_wait
to ensure that we never wait for a request completion in the net.box worker fiber.Closes #5358