Close the WAL when it is no longer in use - #481
Open
samliok wants to merge 4 commits into
Open
Conversation
samliok
marked this pull request as draft
August 3, 2026 21:40
Instance never closed the GarbageCollectedWAL it holds: createEpochConfig overwrote i.wal with a freshly created one on every epoch, and Stop left the last one open. Each dropped WAL keeps its underlying files open, so every epoch change leaked a set of file handles, and they were never released on shutdown. Close the previous WAL before replacing it and close the WAL in Stop.
samliok
force-pushed
the
fix/wal-close-leak
branch
from
August 3, 2026 21:42
2605cf9 to
1fd99c1
Compare
yacovm
reviewed
Aug 4, 2026
yacovm
reviewed
Aug 4, 2026
samliok
marked this pull request as ready for review
August 4, 2026 21:20
yacovm
reviewed
Aug 5, 2026
| // Stop the epoch before doing anything else, so that we don't process any more messages while we are changing epochs. | ||
| i.stopValidator() | ||
|
|
||
| // Wipe out the WALs from the config so we won't try to load them again |
Collaborator
There was a problem hiding this comment.
Wait, doesn't that effectively make us load an empty WAL next invocation of createEpochConfig ?
yacovm
requested changes
Aug 5, 2026
yacovm
left a comment
Collaborator
There was a problem hiding this comment.
I think we have a problem here when we need to create the GC WAL a second time, don't we? The value passed from the config is stale, but we still need something.
I think we should just export .wals in GarbageCollectedWAL or alternatively, return the new WALs after GC:
GarbageCollect(retentionTerm uint64) ([]DeletableWAL ,error)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes the wal when we stop the validator