This moves nNextSweep from being a static variable in LimitOrphans to being a member of the TxOrphanage class. This improves the stability of the txorphan fuzz harness, as each orphanage (created every iteration) now has its own value for nNextSweep.
fuzz: increase `txorphan` harness stability #30186
pull marcofleon wants to merge 2 commits into bitcoin:master from marcofleon:2024/05/txorphan-harness-instability changing 2 files +5 −3-
marcofleon commented at 5:11 PM on May 28, 2024: contributor
-
DrahtBot commented at 5:11 PM on May 28, 2024: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #30111 (locks: introduce mutex for tx download, flush rejection filters on UpdatedBlockTip by glozow)
- #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.
- DrahtBot added the label Tests on May 28, 2024
-
in src/txorphanage.h:110 in c5af5a51a8 outdated
106 | @@ -107,7 +107,7 @@ class TxOrphanage { 107 | int EraseTxNoLock(const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); 108 | 109 | /** Timestamp for the next scheduled sweep of expired orphans */ 110 | - NodeSeconds nNextSweep; 111 | + NodeSeconds n_next_sweep;
dergoegge commented at 6:20 PM on May 28, 2024:Should be
m_notn_, see https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-cmaflcko commented at 6:35 PM on May 28, 2024: memberbut passing on your Mac
The script shouldn't be passing on macos. Otherwise, https://github.com/bitcoin/bitcoin/commit/b3122e167a023df18f67c4083bc72f78968874db doesn't work as intended and should be fixed.
DrahtBot added the label CI failed on May 28, 2024marcofleon force-pushed on May 28, 2024marcofleon force-pushed on May 28, 2024marcofleon commented at 11:51 PM on May 28, 2024: contributorSeems like CI still doesn't like it.
I tried this (no space after -i)
sed -i'' 's/nNextSweep/m_next_sweep/g' $(git grep -l 'nNextSweep')and it didn't work on Mac. Adding the
-ewithout.bakcreates newtxorphanagefiles with-eappended to the end of them. Something liketxorphanage.h-e. Adding.bakprevented that but CI isn't accepting it.maflcko commented at 6:27 AM on May 29, 2024: memberand it didn't work on Mac.
You'll have to install and use gnu-sed on macos, or use Linux. If you don't want to test locally and want to know the syntax without testing, you can look at previous examples via
git log --grep='sed -i'.Though, I am not sure if a three line diff is worth a scripted diff, so an alternative would be to just squash everything down into a single commit.
in src/txorphanage.h:110 in 17d94a19df outdated
104 | @@ -104,6 +105,9 @@ class TxOrphanage { 105 | 106 | /** Erase an orphan by wtxid */ 107 | int EraseTxNoLock(const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); 108 | + 109 | + /** Timestamp for the next scheduled sweep of expired orphans */ 110 | + NodeSeconds m_next_sweep GUARDED_BY(m_mutex);
maflcko commented at 6:38 AM on May 29, 2024:In any case, you are changing the code to leave the variable uninitialized. This is undefined behavior.
You can test this with valgrind, or msan.
marcofleon commented at 9:15 AM on May 30, 2024:Got it, thanks. Should be fixed now.
dergoegge commented at 8:10 AM on May 29, 2024: memberI am not sure if a three line diff is worth a scripted diff
Just for context, I suggested it to marco as a learning exercise.
maflcko commented at 8:13 AM on May 29, 2024: memberSure, sounds good either way. Happy to review once CI is green and the UB is removed.
DrahtBot added the label Needs rebase on May 29, 20240048680467increase txorphan harness stability
initialize variable
8defc182a3scripted-diff: Replace nNextSweep with m_next_sweep
-BEGIN VERIFY SCRIPT- sed -i 's/nNextSweep/m_next_sweep/g' $(git grep -l 'nNextSweep') -END VERIFY SCRIPT- fixing to match style
marcofleon force-pushed on May 29, 2024marcofleon marked this as ready for review on May 29, 2024DrahtBot removed the label Needs rebase on May 29, 2024DrahtBot removed the label CI failed on May 30, 2024marcofleon commented at 9:18 AM on May 30, 2024: contributorYou'll have to install and use gnu-sed on macos, or use Linux. If you don't want to test locally and want to know the syntax without testing, you can look at previous examples via
git log --grep='sed -i'.I installed gnu-sed and used that locally. CI looks good now.
dergoegge approveddergoegge commented at 9:38 AM on May 30, 2024: memberCode review ACK 8defc182a31d828ad0f53ebf7e3be9e9cfc42d09
maflcko commented at 10:52 AM on May 30, 2024: memberutACK 8defc182a31d828ad0f53ebf7e3be9e9cfc42d09
maflcko commented at 10:53 AM on May 30, 2024: membercc @glozow This conflicts with some of your pulls, so maybe you can have a look here? (https://github.com/bitcoin/bitcoin/pull/30186#issuecomment-2135744973)
glozow commented at 6:52 AM on June 2, 2024: memberutACK 8defc182a31d828ad0f53ebf7e3be9e9cfc42d09, I can rebase on this pretty easily
fanquake merged this on Jun 3, 2024fanquake closed this on Jun 3, 2024Fabcien referenced this in commit 0fafd7b709 on Jul 19, 2024roqqit referenced this in commit 0d319003dd on Aug 1, 2024marcofleon deleted the branch on Nov 19, 2024bitcoin locked this on Nov 19, 2025
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 03:13 UTC
More mirrored repositories can be found on mirror.b10c.me