Skip to content

Make child task submission idempotent and thread-safe in FuturesDependencyExecutor#158

Merged
gpauloski merged 1 commit intomainfrom
issue-156
Sep 10, 2024
Merged

Make child task submission idempotent and thread-safe in FuturesDependencyExecutor#158
gpauloski merged 1 commit intomainfrom
issue-156

Conversation

@gpauloski
Copy link
Copy Markdown
Contributor

Description

Make child task submission idempotent and thread-safe in FuturesDependencyExecutor. This specifically targets _Task._submit which used to assert it is only ever called once. It can now be called multiple times, but the submission will only ever be performed by the first thread.

I thought about using locks more liberally in other places to maintain the internal assertion that _submit() is only called once, but ultimately I think this solution is easier to reason about.

Related to #145, which addressed some other race conditions.

Fixes #156

Type of Change

  • Bug (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds or improves functionality)
  • Internal (refactoring, performance, and testing)
  • Breaking (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (no changes to the code)
  • Development (CI workflows, packages, templates, etc.)
  • Package (package dependencies and versions)

Testing

Not really... I couldn't reliably reproduce the error.

Pull Request Checklist

Please confirm the PR meets the following requirements.

  • Relevant tags are added (breaking, bug, documentation, enhancement, package, etc.).
  • Code changes pass pre-commit (e.g., ruff, mypy, etc.).
  • Tests have been added to show the fix is effective or that the new feature works.
  • New and existing unit tests pass locally with the changes.
  • Docs have been updated and reviewed if relevant.

@gpauloski gpauloski added the bug Something isn't working label Sep 10, 2024
@gpauloski gpauloski merged commit 5037b89 into main Sep 10, 2024
@gpauloski gpauloski deleted the issue-156 branch September 10, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in FutureDependencyExecutor -- Round 2

1 participant