question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need timeouts and proper task-cancellation when dealing with trinity's proxied-services

See original GitHub issue

Currently 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:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gsalgadocommented, Jun 4, 2018

#860 addresses part of this

1reaction
gsalgadocommented, Jun 4, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found