-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[test][exporter/prometheus] TestPrometheusExporter failures #36139
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@dashpole I can have a closer look on monday and come up with a new PR. If that's not fast enough for you feel free to revert and I'll open a new PR reintroducing the changes + fix.
I think that's a likely explanation. I'll do some experimentation to confirm your hypothesis. If I'm not mistaken the error only occurs sporadically, so it's likely to be a race condition. My apologies. |
Monday should be fine. I won't be able to review for a while, but other approvers are free to do so. |
I can confirm that this error happens when Edit: While this sequence causes an error like this, I don't think this is the root cause, since the error returned by |
…pen-telemetry#36139) Signed-off-by: Argannor <arga@argannor.com>
@Argannor correct, that first glance was wrong. Looking again at the error message it says |
…pen-telemetry#36164) #### Description Adjusted the Start and Shutdown sequence of the prometheusexporter to prevent a race condition causing the `close tcp 127.0.0.1:8999: use of closed network connection` error as observed in open-telemetry#36139. The behaviour was changed in the following ways: - If an error occurs during the creation of the server, close the listener immediately, leaving shutdown a noop - Since `srv.Shutdown` will close all open listeners, the explicit call to `ln.Close` in the shutdown routine was removed #### Link to tracking issue Fixes open-telemetry#36139 #### Testing Unit testing, I temporarily increased the number of iterations on `TestPrometheusExporter` to 2000. The error did no longer occur. However sporadically another error occured: ``` === RUN TestPrometheusExporter prometheus_test.go:103: Error Trace: C:/development/code/opentelemetry-collector-contrib/exporter/prometheusexporter/prometheus_test.go:84 Error: Received unexpected error: listen tcp 127.0.0.1:8999: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted. Test: TestPrometheusExporter --- FAIL: TestPrometheusExporter (1.16s) ``` I assume that this is because the OS (in my case Windows) won't always close the underlying sockets immediately, blocking it for some time afterwards. I'm not sure there is anything we can do about that. --------- Signed-off-by: Argannor <arga@argannor.com>
…pen-telemetry#36164) #### Description Adjusted the Start and Shutdown sequence of the prometheusexporter to prevent a race condition causing the `close tcp 127.0.0.1:8999: use of closed network connection` error as observed in open-telemetry#36139. The behaviour was changed in the following ways: - If an error occurs during the creation of the server, close the listener immediately, leaving shutdown a noop - Since `srv.Shutdown` will close all open listeners, the explicit call to `ln.Close` in the shutdown routine was removed #### Link to tracking issue Fixes open-telemetry#36139 #### Testing Unit testing, I temporarily increased the number of iterations on `TestPrometheusExporter` to 2000. The error did no longer occur. However sporadically another error occured: ``` === RUN TestPrometheusExporter prometheus_test.go:103: Error Trace: C:/development/code/opentelemetry-collector-contrib/exporter/prometheusexporter/prometheus_test.go:84 Error: Received unexpected error: listen tcp 127.0.0.1:8999: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted. Test: TestPrometheusExporter --- FAIL: TestPrometheusExporter (1.16s) ``` I assume that this is because the OS (in my case Windows) won't always close the underlying sockets immediately, blocking it for some time afterwards. I'm not sure there is anything we can do about that. --------- Signed-off-by: Argannor <arga@argannor.com>
Component(s)
exporter/prometheus
Describe the issue you're reporting
A few instances of failures:
In quick glance this seems likely because the server using the port is actually launched in a goroutine and the port can be closed by shutdown before the server starts.
The text was updated successfully, but these errors were encountered: