fix(ActiveQueryTracker): avoid SIGBUS by explicitly allocating active query log file#433
Open
u-veles-a wants to merge 7 commits into
Open
fix(ActiveQueryTracker): avoid SIGBUS by explicitly allocating active query log file#433u-veles-a wants to merge 7 commits into
u-veles-a wants to merge 7 commits into
Conversation
… query log file Signed-off-by: Alexandr Yudin <57181751+u-veles-a@users.noreply.github.com>
Signed-off-by: Alexandr Yudin <57181751+u-veles-a@users.noreply.github.com>
vporoshok
approved these changes
Jul 23, 2026
vporoshok
enabled auto-merge (squash)
July 23, 2026 07:27
Signed-off-by: Alexandr Yudin <57181751+u-veles-a@users.noreply.github.com>
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.
Description
The active query tracker uses a memory-mapped queries.active file. Previously, the file was sized with file.Truncate, which can create a sparse file on some filesystems. In that case, the operating system may accept the file size change without physically allocating the required disk space. If the disk later becomes full and Prometheus tries to write to it, the write can fail with SIGBUS.
This change, preallocates the active query tracker file by writing zeroes to it and syncing it before the file is memory-mapped. This makes the failure mode explicit and recoverable during startup or initialization.
The code is copied from the upstream.