Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status: avoid holding mutex over network i/o #10228

Merged
merged 3 commits into from Oct 26, 2016

Conversation

tbg
Copy link
Member

@tbg tbg commented Oct 26, 2016

The writer passed to (*MetricsRecorder).PrintAsText may not consume
quickly
(after all, it is usually a TCP/IP connection) and when it doesn't, the
resulting deadlock brought the server to its knees.


This change is Reviewable

First step in addressing a bad critical section in
`(*MetricsRecorder).PrintAsText` which holds a mutex over the (possibly
blocking, because network i/o) call to `(*PrometheusExporter).Export`.
Clarify that prometheus scrapes metrics, not holding on to any of their
underlying state. Verified that all implementors of `PrometheusExportable`
adhere to the expected semantics.
The writer passed to `(*MetricsRecorder).PrintAsText` may not consume quickly
(after all, it is usually a TCP/IP connection) and when it doesn't, the
resulting deadlock brought the server to its knees.
@tbg tbg force-pushed the prometheus-critical-section branch from 6e22fd3 to d6509d9 Compare October 26, 2016 11:13
@mberhault
Copy link
Contributor

LGTM

Copy link
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (though I'm not familiar with this code).

@tamird
Copy link
Contributor

tamird commented Oct 26, 2016

:lgtm:


Reviewed 1 of 1 files at r1, 4 of 4 files at r2, 1 of 1 files at r3.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@tbg tbg merged commit 7b94b9a into cockroachdb:master Oct 26, 2016
@tbg tbg deleted the prometheus-critical-section branch October 26, 2016 12:58
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.

None yet

5 participants