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

fix: wait for HTTP server serve() termination #348

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rogercoll
Copy link

Fixes #347

@rogercoll rogercoll requested a review from a team as a code owner February 11, 2025 14:28
Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 78.22%. Comparing base (2ecac8d) to head (372361f).

Files with missing lines Patch % Lines
server/serverimpl.go 65.00% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #348      +/-   ##
==========================================
- Coverage   78.29%   78.22%   -0.07%     
==========================================
  Files          25       25              
  Lines        2386     2402      +16     
==========================================
+ Hits         1868     1879      +11     
- Misses        410      414       +4     
- Partials      108      109       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if err != nil {
return err
}
s.httpServerServeWg.Wait()
Copy link
Member

Choose a reason for hiding this comment

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

This needs to honour ctx cancellation. If context is Done(), Stop() needs to return with an error. I am not sure if this is going to be the behavior, given that Wait() can wait indefinitely long. Please add a test that verifies the cancellation case.

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense to me, added in 4e4986f

@tigrannajaryan
Copy link
Member

Please update doc-comment of OpAMPServer.Stop() to explain that it waits until the server socket is released.

@rogercoll
Copy link
Author

looks like there is an unrelated flaky test on the examples:
2025/02/13 14:49:28.332879 [OPAMP] Could not load TLS config, working without TLS: open ../../certs/certs/ca.cert.pem: no such file or directory

@rogercoll
Copy link
Author

related data race issue #256

@tigrannajaryan
Copy link
Member

related data race issue #256

I rerun the build a couple times and it fails. Perhaps this PR changed timings and the race is now encountered more consistently. Regardless of the reason I can't merge the PR if the build does not pass. We need to fix #256 first.

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.

[HTTP] Server shutdown completes before serve() terminates
2 participants