Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uninterruptibleCancel in JobPool #2851

Merged
merged 2 commits into from
Jan 11, 2021

Conversation

coot
Copy link
Contributor

@coot coot commented Jan 11, 2021

JobPool is using bracket which requires that the resource finalizer is
uninterruptible. Could this introduce a deadlock? I don't think so, only if
there already was a deadlock which forbid to deliver asynchronous exception.
This could happen either deadlock in FFI, or a tight loop which does not
allocate.

Both async library is using uninterruptibleCancel in withAsync
combinator, and ouroboros-consensus is using it as well in their more
sophisticated version of ResourceRegistery.

  • ouroboros-network:cddl: ListLike bound
  • job-pool: use uninterruptible handler in bracket

Recent versions of ListLike is not compatible with bytestring-0.10.12.0
or newer: ddssff/listlike#13
@coot coot requested a review from dcoutts January 11, 2021 09:59
@coot coot force-pushed the coot/job-pool-uninterruptibleCancel branch from 9799742 to 0e1ac6b Compare January 11, 2021 10:00
Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coot
Copy link
Contributor Author

coot commented Jan 11, 2021

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 11, 2021

@iohk-bors iohk-bors bot merged commit 7776675 into master Jan 11, 2021
@iohk-bors iohk-bors bot deleted the coot/job-pool-uninterruptibleCancel branch January 11, 2021 12:59
coot added a commit that referenced this pull request May 16, 2022
2851: Use uninterruptibleCancel in JobPool r=coot a=coot

JobPool is using bracket which requires that the resource finalizer is
uninterruptible.  Could this introduce a deadlock? I don't think so, only if
there already was a deadlock which forbid to deliver asynchronous exception.
This could happen either deadlock in FFI, or a tight loop which does not
allocate.

Both `async` library is using `uninterruptibleCancel` in `withAsync`
combinator, and `ouroboros-consensus` is using it as well in their more
sophisticated version of `ResourceRegistery`.

- ouroboros-network:cddl: ListLike bound
- job-pool: use uninterruptible handler in bracket


Co-authored-by: Marcin Szamotulski <profunctor@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants