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.
Description
The
jsonrpc
filter was not removed elegantly when timeout, and might block querying even the whole program in some extreme cases.When triggered, it kept printing log like that:
The PR fixes this issue. Here is the solution.
We use only one timer and reset it for the
timeout
checking, and do nothing when the timer fired.The timer puts down the responsibility of handling the business, its only purpose is to make the loop go round.
That makes sense.
If the node is idle, it should not wait too long for the hurry serving.
If the node is busy, it should focus on the current job instead of distracted from dealing with clutter.
And finally, It shouldn't bordered by the timeout filters, so we remove all those outdated filters once and for all.
Changes include
Checklist
Testing
Manual tests
eth_newBlockFilter
,eth_newLogFilter
,eth_getFilterChanges
requests usingcurl
or WebSocket client, in order to trigger with different timeout timestamps.We should find only one 'adding', 'deletion' for each filter, and never get any repeated timeout logs no matter how many times we test.