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

Fix txpool dump/restore race condition #6665

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Mar 1, 2024

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Most advanced CI tests are deferred until PR approval, but you could:

  • locally run all unit tests via: ./gradlew build
  • locally run all acceptance tests via: ./gradlew acceptanceTest
  • locally run all integration tests via: ./gradlew integrationTest
  • locally run all reference tests via: ./gradlew ethereum:referenceTests:referenceTests

PR description

The disk access was not properly guarded against overlapping dump/restore tasks

Fixed Issue(s)

fixes #6664

@fab-10 fab-10 force-pushed the fix-txpool-dump-restore-lock branch from fc13770 to b461ed1 Compare March 1, 2024 16:47
@fab-10 fab-10 marked this pull request as ready for review March 1, 2024 17:08
} catch (InterruptedException ie) {
isCancelled.set(false);
} finally {
diskAccessLock.unlock();
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not need the equivalent of releasing in finally

Copy link
Contributor Author

@fab-10 fab-10 Mar 12, 2024

Choose a reason for hiding this comment

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

no and this was the error, since the operation is run async, we can't know here when it is done, and so it is not up to us to release the lock, but the lock must be released after the async operation is done with this code CompletableFuture.runAsync(operation).thenRun(diskAccessLock::release));

@fab-10 fab-10 enabled auto-merge (squash) March 13, 2024 10:21
@fab-10 fab-10 merged commit efd1bc7 into hyperledger:main Mar 13, 2024
42 checks passed
@fab-10 fab-10 deleted the fix-txpool-dump-restore-lock branch March 13, 2024 10:48
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
matthew1001 pushed a commit to kaleido-io/besu that referenced this pull request Jun 7, 2024
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.

Race condition in txpool dump/restore
2 participants