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

Do not report fatal error if err is server closed #9559

Merged
merged 2 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- `resourcedetectionprocessor`: Wire docker detector (#9372)
- `kafkametricsreceiver`: The kafkametricsreceiver was changed to connect to kafka during scrape, rather than startup. If kafka is unavailable the receiver will attempt to connect during subsequent scrapes until succcessful (#8817).
- `datadogexporter`: Update Kubernetes example manifest to new executable name. (#9425).
- `opencensusreceiver`: Do not report fatal error if err is server closed (#9559).

## v0.49.0

Expand Down
14 changes: 8 additions & 6 deletions receiver/opencensusreceiver/opencensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,20 @@ func (ocr *ocReceiver) startServer(host component.Host) error {

httpL := m.Match(cmux.Any())
go func() {
if errGrpc := ocr.serverGRPC.Serve(grpcL); !errors.Is(errGrpc, grpc.ErrServerStopped) && errGrpc != nil {
host.ReportFatalError(errGrpc)
// Check for cmux.ErrServerClosed, because during the shutdown this is not properly close before closing the cmux,
// see TODO in Shutdown.
if err := ocr.serverGRPC.Serve(grpcL); !errors.Is(err, grpc.ErrServerStopped) && !errors.Is(err, cmux.ErrServerClosed) && err != nil {
host.ReportFatalError(err)
}
}()
go func() {
if errHTTP := ocr.httpServer().Serve(httpL); !errors.Is(errHTTP, http.ErrServerClosed) && errHTTP != nil {
host.ReportFatalError(errHTTP)
if err := ocr.httpServer().Serve(httpL); !errors.Is(err, http.ErrServerClosed) && err != nil {
host.ReportFatalError(err)
}
}()
go func() {
if errServe := m.Serve(); errServe != nil && errServe != cmux.ErrServerClosed {
host.ReportFatalError(errServe)
if err := m.Serve(); !errors.Is(err, cmux.ErrServerClosed) && err != nil {
host.ReportFatalError(err)
}
}()
return nil
Expand Down