Skip to content

fix: deleted_libraries.py counts only the first deleted library per process - #281

Open
Bierchermuesli wants to merge 1 commit into
prometheus-community:masterfrom
Bierchermuesli:deleted-libraries-count-all
Open

Bierchermuesli wants to merge 1 commit into
prometheus-community:masterfrom
Bierchermuesli:deleted-libraries-count-all

Conversation

@Bierchermuesli

Copy link
Copy Markdown

deleted_libraries.py only records the first deleted library of each process. The counting block is indented one level too deep, under if path not in processes_linking_deleted_libraries:, so it only runs the first time a process is seen.

A process still mapping a stale libssl and libc after an upgrade shows up under one of them only. Alerts on "any process links a deleted library" still fire, but per-library counts and topk by (library_name) views miss most of the picture. On a test host after upgrades:

libraries process/library pairs
master 3 15
this PR 14 75

This dedents the block so it runs for every matching line. The per-process {library: count} map and the rest of the script are unchanged. The bug dates back to f393634 (#957), when the script was added.

flake8 clean. Results cross-checked against an independent shell/awk implementation of the same logic over /proc/*/maps, identical sample for sample.

The counting block is nested under "first time this process is seen", so
only the first deleted library of each process was recorded. A process
still mapping a stale libssl and libc showed up under one of them only.
On a test host after upgrades the script reported 3 libraries / 15
process-library pairs instead of 14 / 75.

Dedent the block so it runs for every matching line. The bug has been
there since the script was added in f393634.

Signed-off-by: Stefan Grosser <13567009+Bierchermuesli@users.noreply.github.com>
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