Skip to content

Close ring-buffer readers on tracer init failure - #181

Merged
nickschuch merged 1 commit into
mainfrom
fix/tracer-reader-leaks
Sep 4, 2026
Merged

Close ring-buffer readers on tracer init failure#181
nickschuch merged 1 commit into
mainfrom
fix/tracer-reader-leaks

Conversation

@nickschuch

Copy link
Copy Markdown
Contributor

The FPM tracer opened the events reader and then the Drupal cache reader; if the second open failed, the first was never closed, because ringreader.Run, which takes ownership of both, was never reached. Across the collector supervisor's restart loop a recurring failure leaked a kernel ring-buffer mapping each attempt. Close the events reader on that error path.

ringreader.Run also leaked the readers it was handed if source validation failed before its cleanup goroutine took over. Close all provided readers on the validation-failure path too, via a shared closeAll helper, and add a test. The single-reader CLI and Node tracers hand their reader straight to Run with no intervening fallible step, so this covers them as well.

The FPM tracer opened the events reader and then the Drupal cache reader; if
the second open failed, the first was never closed, because ringreader.Run,
which takes ownership of both, was never reached. Across the collector
supervisor's restart loop a recurring failure leaked a kernel ring-buffer
mapping each attempt. Close the events reader on that error path.

ringreader.Run also leaked the readers it was handed if source validation
failed before its cleanup goroutine took over. Close all provided readers on
the validation-failure path too, via a shared closeAll helper, and add a test.
The single-reader CLI and Node tracers hand their reader straight to Run with
no intervening fallible step, so this covers them as well.
@nickschuch
nickschuch merged commit 12da3ab into main Sep 4, 2026
5 of 6 checks passed
@nickschuch
nickschuch deleted the fix/tracer-reader-leaks branch September 4, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant