Skip to content

fix(ActiveQueryTracker): avoid SIGBUS by explicitly allocating active query log file#433

Open
u-veles-a wants to merge 7 commits into
ppfrom
fix_active_query_tracker
Open

fix(ActiveQueryTracker): avoid SIGBUS by explicitly allocating active query log file#433
u-veles-a wants to merge 7 commits into
ppfrom
fix_active_query_tracker

Conversation

@u-veles-a

Copy link
Copy Markdown
Collaborator

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.

… query log file

Signed-off-by: Alexandr Yudin <57181751+u-veles-a@users.noreply.github.com>
@u-veles-a u-veles-a added this to the next milestone Jul 22, 2026
@u-veles-a
u-veles-a requested a review from vporoshok July 22, 2026 15:17
@u-veles-a u-veles-a self-assigned this Jul 22, 2026
@u-veles-a u-veles-a added the bug Something isn't working label Jul 22, 2026
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 vporoshok modified the milestones: next, v0.9.0, v0.8.5 Jul 23, 2026
@vporoshok
vporoshok enabled auto-merge (squash) July 23, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants