Need timeouts and proper task-cancellation when dealing with trinity's proxied-services
See original GitHub issueCurrently our chain syncer implementation do things like:
await wait_with_token(chaindb.coro_import_block(block), token=self.cancel_token)
Where chaindb is a multiprocessing
proxy that runs the actual block importing in a separate process. Since we’re dealing with a separate process that may die halfway through importing the block, or hang completely and never respond, I believe we should always specify timeouts when dealing with them – in the same way we do for network operations.
Also, by wrapping those with wait_with_token() only cancels the outer task and not the one that is actually doing the work, which is created inside coro_import_block() by the await loop.run_in_executor(…) call. Maybe we just need to pass the CancelToken to coro_import_block() and have it use that with wait_with_token() instead of us.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Task Cancellation | Microsoft Learn
Cancel method and the user delegate terminating the operation in a timely manner. You can terminate the operation by using one of these...
Read more >Cancellation, Part 2: Requesting Cancellation - Stephen Cleary
One common need for cancellation is implementing a timeout. The solution is to have a timer that requests cancellation when it expires.
Read more >Timeouts and cancellation for humans — njs blog
So – what's so hard about timeout handling? Contents: Simple timeouts don't support abstraction; Absolute deadlines are composable (but kinda ...
Read more >Supplemental Document: BIG-IP 13.0.0 Fixes and Known Issues
SSL does not cancel pending sign request before the handshake times out or is canceled. 634265, 2-Critical, Using route pools whose members aren't...
Read more >Why Do You Need a Cancellation Token in C# for Tasks?
You may need to cancel the task for many reasons: operation timeout, exceeding resource limits, etc. You always need to handle the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
#860 addresses part of this
@carver actually, they’re not terminated in order: https://github.com/ethereum/py-evm/issues/827#issuecomment-394317506