]> git.hungrycats.org Git - bees/commitdiff
tempfile: erase the temp_transid hold in the destructor
authorZygo Blaxell <bees@furryterror.org>
Wed, 2 Sep 2026 04:00:04 +0000 (00:00 -0400)
committerZygo Blaxell <bees@furryterror.org>
Sat, 5 Sep 2026 04:04:15 +0000 (00:04 -0400)
note_data_transid() registers the tempfile's transid in
BeesContext::m_temp_transid so the extent crawler cannot advance into
the range where the tempfile's extents are still acquiring refs.
reset() erases the entry at the start of each mutation cycle, but the
destructor did not: a BeesTempFile destroyed while holding data (a
worker thread torn down, or an exception unwinding past the dedupe
that would have reset it) left its entry in the map forever.  The
dead entry pins temp_transid_min() at that transid, and the crawler
stalls permanently behind a file that no longer exists
(crawl_temp_transid_hold counts the held polls).

Erase the entry in the destructor alongside the fd-cache and
blacklist cleanup.

Assisted-by: Claude-Code:claude-fable-5
src/bees-tempfile.cc

index ca130c656c49a9cb4b7c551f689092433482f0bc..a52d4096ba2d06bef935a99d20bbfcb610d5b96a 100644 (file)
@@ -117,6 +117,13 @@ BeesTempFile::~BeesTempFile()
 
        // Remove from blacklist
        m_ctx->blacklist_erase(BeesFileId(m_fd));
+
+       // Drop the crawler hold.  reset() erases it on every mutation
+       // cycle, but a tempfile destroyed while holding data (worker
+       // teardown, unwound exception) would otherwise pin
+       // temp_transid_min() at its transid forever and stall the extent
+       // crawler behind a file that no longer exists.
+       m_ctx->temp_transid_erase(BeesFileId(m_fd));
 }
 
 static