Skip to content

Conversation

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 23, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK instagibbs, theStack, dergoegge
Concept ACK hebasto

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30110 (refactor: TxDownloadManager by glozow)
  • #29641 (scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint by maflcko)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member

hebasto commented Jul 24, 2024

Concept ACK.

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

ACK 1a0212c8e5c25fce2e0a2cab3113b25f2fbc38b7

Copy link
Member

Choose a reason for hiding this comment

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

note to myself: See if ACQUIRED_BEFORE helps here at compile time

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, added a ACQUIRED_BEFORE, but compiler didn't complain when I added a LOCK2(m_mempool.cs, m_tx_download_mutex)

Copy link
Member

@hebasto hebasto Jul 25, 2024

Choose a reason for hiding this comment

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

From https://clang.llvm.org/docs/ThreadSafetyAnalysis.html:

ACQUIRED_BEFORE(…) and ACQUIRED_AFTER(…) are currently being developed under the -Wthread-safety-beta flag.


Hm, added a ACQUIRED_BEFORE, but compiler didn't complain when I added a LOCK2(m_mempool.cs, m_tx_download_mutex)

With CXXFLAGS=-Wthread-safety-beta, clang emits a warning:

net_processing.cpp:2078:5: warning: mutex 'm_tx_download_mutex' must be acquired before 'cs' [-Wthread-safety-analysis]
    LOCK2(m_mempool.cs, m_tx_download_mutex);
    ^
./sync.h:260:16: note: expanded from macro 'LOCK2'
    UniqueLock criticalblock2(MaybeCheckNotHeld(cs2), #cs2, __FILE__, __LINE__)
               ^
1 warning generated.

glozow added 2 commits July 24, 2024 10:38
Now that m_txrequest and m_recent_confirmed_transactions are guarded by
the same mutex, there is no benefit to processing them separately.
Instead, just loop through pblock->vtx once.
@glozow glozow force-pushed the 2024-07-30111-followups branch from 1a0212c to 1b732db Compare July 24, 2024 11:52
@glozow glozow marked this pull request as ready for review July 24, 2024 11:53
Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

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

ACK 1b732db

@DrahtBot DrahtBot requested a review from dergoegge July 24, 2024 14:16
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

lgtm ACK 1b732dbc3bd9c59303a774cf2095c2d6639dbe1d
(happy to re-ACK if the Assert suggestion for pindexNewTip is taken)

glozow added 3 commits July 25, 2024 11:01
- add AssertLockNotHeld(m_tx_download_mutex) in net_processing
- move doc about m_tx_download_mutex and mempool mutex to ActiveTipChange
@glozow glozow force-pushed the 2024-07-30111-followups branch from 1b732db to 7c29e55 Compare July 25, 2024 11:22
@instagibbs
Copy link
Member

reACK 7c29e55

@DrahtBot DrahtBot requested a review from theStack July 25, 2024 12:06
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

re-ACK 7c29e55

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

reACK 7c29e55

@fanquake fanquake merged commit 5d28013 into bitcoin:master Jul 25, 2024
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

Post-merge ACK 7c29e55.

@glozow glozow deleted the 2024-07-30111-followups branch July 25, 2024 15:30
@bitcoin bitcoin locked and limited conversation to collaborators Oct 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants