Skip to content

[#325] Release the metrics cache lock when a client disconnects - #725

Open
LoayTarek5 wants to merge 1 commit into
pgexporter:mainfrom
LoayTarek5:fix-empty-reply-325
Open

LoayTarek5 wants to merge 1 commit into
pgexporter:mainfrom
LoayTarek5:fix-empty-reply-325

Conversation

@LoayTarek5

Copy link
Copy Markdown

Fix #325

if a client hangs up while /metrics is being served, the metrics child gets killed by SIGPIPE while it holds the prometheus cache lock, so the lock is never released, after that every scrape waits blocking_timeout and gets an empty reply, and pgexporter-cli clear prometheus hangs the main process since it spins on the same lock

so now the http children ignore SIGPIPE, so the write fails with EPIPE instead, and metrics_page releases the lock before every goto error inside the locked section, same as bridge.c got in #635, both are needed, with only one of them the test still fails

also added test_http_metrics_client_reset, it resets the connection mid scrape and checks the next scrape still gets a 200, my AUTHORS entry is in #702

@LoayTarek5

LoayTarek5 commented Dec 1, 2026 •

Copy link
Copy Markdown
Author

@fheikens , @jesperpedersen, also found a few related things while working on this (reset spinning with no timeout, the writes in output_all_metrics not being checked, the http client spinning when the server closes before the header), i will open separate issues for them

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.

Empty replay from server

1 participant