For files that are eligible, dur::Journal::removeUnneededJournalFiles() calls removeOldJournalFile to recycle/remove the journal file.
However, in the meantime, another thread may have already done this, via dropDatabase or fsyncLock, both of which call
- syncDataAndTruncateJournal
- journalCleanup
- Journal::cleanup
- removeJournalFiles
This causes removeOldJournalFile to spuriously complain about the missing journal file when it tries to rename/remove it, falsely suggesting that the journal file has been prematurely removed (either by mongod or by something else).
A quick fix would be for removeOldJournalFile to simply check that the given path exists and short circuit return if not. That will still leave a brief TOCTTOU race, so it might be better to figure out a real/more appropriate fix.