GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][txn] Fix SnapshotSegmentAbortedTxnProcessorImpl thread safety issue by nikam14 · Pull Request #22384 · apache/pulsar

Conversation

@nikam14

@nikam14 nikam14 commented Mar 29, 2024

Copy link
Copy Markdown
Contributor

Fixes #22116

Motivation

Fix SnapshotSegmentAbortedTxnProcessorImpl thread safety issue

Modifications

  1. Added volatile keyword to unsealedtxnIds variable.
  2. Same resource were accessed at same line , so modified it.
  3. Added synchronized keyword for data consistency

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
nikam14 added 4 commits March 20, 2024 15:45
@nikam14
Removed thread safety issues in SnapshotSegmentAbortedTxnProcessorImp…
d7019c4
…l.java
@nikam14
Update SnapshotSegmentAbortedTxnProcessorImpl.java
64a4a57
@nikam14
Update SnapshotSegmentAbortedTxnProcessorImpl.java
282d9a6
@nikam14
Update SnapshotSegmentAbortedTxnProcessorImpl.java
9158036
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Mar 29, 2024
lhotari
lhotari requested changes Apr 5, 2024
View reviewed changes

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the contribution @nikam14 .

Unfortunately fixing these issues isn't simple. This PR might be doing the right things, but without proper concurrency tests, it's hard to ensure that adding synchronized methods doesn't cause regressions such as dead-locks. The lack of tests isn't caused by this PR, but to get confidence for merging such PRs, it would have to be resolved.
Just viewing the code won't be a sufficient review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nikam14

nikam14 commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for the explanation @lhotari

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@merlimat

merlimat commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Thanks @nikam14, and sorry this sat so long. Master has changed a lot since this PR: snapshot recovery was rewritten in #26335, and every read and write of aborts now runs under the TopicTransactionBuffer monitor. The locks added here are on different monitors that no writer takes, so they wouldn't close the remaining gaps. Those gaps are getStats → generateSnapshotStats running without that lock, and updateIndexWhenExecuteTheLatestTask copying unsealedTxnIds on the writer thread. I'm closing this as part of the backlog triage and will add those details to #22116, which stays open. A fix along those lines, with a concurrency test, would be very welcome.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@merlimat merlimat closed this Oct 22, 2026
@merlimat merlimat mentioned this pull request Oct 22, 2026
[Bug] SnapshotSegmentAbortedTxnProcessorImpl contains thread safety issues #22116
Open
1 of 2 tasks
@namest504 namest504 mentioned this pull request Nov 27, 2026
[fix][txn] Take the transaction buffer lock when reading the snapshot stats #27772
Open
1 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lhotari lhotari lhotari requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug] SnapshotSegmentAbortedTxnProcessorImpl contains thread safety issues

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@nikam14 @merlimat @lhotari
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.