Repository navigation
executor: stop a contract method once its node has closed the connection - #12
Merged
Merged
Conversation
The node waits executor_receive_timeout (4 s by default) for an answer, records the call as timed out and closes the connection; the executor gives the method the execution time the node sends (60 s). A method that runs past the node's wait went on, holding a CPU, for an answer nobody could read, and a node sends its next calls meanwhile. While a method runs, the Thrift thread now looks every 250 ms whether the node closed the connection of the request (end of stream on it, peeked without consuming anything) and stops the method as at its limit. An answer on a closed connection cannot be delivered, so what the node records does not change; with the connection open everything is as before.
…x/stop-orphan-calls
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The node waits
executor_receive_timeout(4 s by default) for an answer, records the call as timed out (TimeExpired) and closes the connection; the executor gives the method the execution time the node sends (Consensus::TimeSmartContract, 60 s). A method running past the node's wait went on, holding a CPU, for an answer nobody could read, while the node sent its next calls: with paid calls, executors of the confidants could be kept busy.ClientConnectionwraps the server's processor so that each request knows its connection (TSocket).LimitedExecutionMethodwaits for the method in slices of 250 ms; between them it peeks the connection (1 ms read on the buffered stream with mark/reset: nothing is consumed). On end of stream the method is stopped exactly as at its limit.Compatibility: an answer on a closed connection cannot be delivered, so what the node records does not change. With the connection open the code path is the one of build 1518 (the deadline is the same execution time). Unknown transports or any error count as open.
Test plan
abandoned_call, api: refuse a contract call whose method the executor cannot find node#132): a method running past a 3 s client wait; this branch logs<contract>: the node closed the connection, the call is stoppedand answers the next call; 1518 keeps running itwaitCorrectCompleteOfSmartContract, whose 3 ms grace is too short on a loaded machine: it fails 4 times out of 4 on 511d7f7 too)🤖 Generated with Claude Code