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

Query service: fix logging errors on SIGINT #1601

Merged
merged 2 commits into from
Jun 17, 2019

Conversation

jan25
Copy link
Contributor

@jan25 jan25 commented Jun 13, 2019

Signed-off-by: Abhilash Gnan abhilashgnan@gmail.com

Which problem is this PR solving?

Short description of the changes

  • Query service servers return errors on SIGINT (when we call Close() on them). This PR handles such errors correctly and stops from logging

Previously merged PR: #1598 - I think, fixed the similar issue, but solving for SIGTERM. So it stopped from logging errors when i tested rebuilt query image inside a all-in-one pod

@codecov
Copy link

codecov bot commented Jun 13, 2019

Codecov Report

Merging #1601 into master will decrease coverage by 0.04%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1601      +/-   ##
==========================================
- Coverage   98.81%   98.76%   -0.05%     
==========================================
  Files         191      191              
  Lines        9162     9165       +3     
==========================================
- Hits         9053     9052       -1     
- Misses         85       88       +3     
- Partials       24       25       +1
Impacted Files Coverage Δ
cmd/query/app/server.go 90.32% <60%> (-6.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb6640b...1bce499. Read the comment docs.

@@ -113,7 +113,8 @@ func (s *AdminServer) serveWithListener(l net.Listener) {
s.server = &http.Server{Handler: recoveryHandler(s.mux)}
s.logger.Info("Starting admin HTTP server", zap.Int("http-port", s.adminPort))
go func() {
if err := s.server.Serve(l); err != nil {
err := s.server.Serve(l)
if err != nil && err != http.ErrServerClosed {
Copy link
Member

Choose a reason for hiding this comment

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

should we make it consistent with the other and use case nil, http.ErrServerClosed, cmux.ErrListenerClosed:?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice tip

cmd/query/app/server.go Show resolved Hide resolved
cmd/query/app/server.go Show resolved Hide resolved
@jan25 jan25 force-pushed the actually-fix-query-error branch from 7eb069e to 3b6a3d2 Compare June 14, 2019 20:44
@jan25
Copy link
Contributor Author

jan25 commented Jun 14, 2019

As a side note: When i just clicked "Merge master" in this PR the merge commit is not signed automatically, perhaps something to fix in the github workflow?

@yurishkuro
Copy link
Member

it's the Revert "add comments for readability" commit that's not signed. Master merge is usually ok.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

lgtm. Could you add tests for graceful exit in server.go ?

@jan25 jan25 force-pushed the actually-fix-query-error branch from 7ec8dbc to e9ac256 Compare June 16, 2019 09:38
@jan25
Copy link
Contributor Author

jan25 commented Jun 16, 2019

Added test to check for errors in logs on server.Close()

I may have messed up git history when trying to sign one of my commits i pushed earlier. Now DCO complains about author issue on a commit which came from merging master

@@ -114,6 +119,7 @@ func (s *Server) Start() error {
// Start GRPC server concurrently
go func() {
s.svc.Logger.Info("Starting GRPC server", zap.Int("port", s.queryOptions.Port))

if err := s.grpcServer.Serve(grpcListener); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

this is the same pattern as with the other two servers, but it works fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, grpc doesn't complain. I guess it has to do with how grpc.Serve() is implemented. Unlike with http.Serve(), grpc doesn't throw errors after grpc.Stop()

@yurishkuro
Copy link
Member

you can try squashing the commits to have a single signed commit, or alter the commit message in the old commit via interactive rebase.

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
@jan25 jan25 force-pushed the actually-fix-query-error branch from 3d4be90 to f0c01eb Compare June 16, 2019 15:57
@pavolloffay
Copy link
Member

@jan25 did you try to increase coverage?

@jan25
Copy link
Contributor Author

jan25 commented Jun 17, 2019

Thanks for the review!

The additional test case tried to improve the coverage. I think codecov is talking about the else blocks which are written with default: which might've resulted in tiny dip in coverage, not entirely sure how codecov works. Please suggest if its possible to improve further

@yurishkuro yurishkuro merged commit f62a0a3 into jaegertracing:master Jun 17, 2019
@jan25 jan25 deleted the actually-fix-query-error branch June 17, 2019 18:40
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.

Query and all-in-one generates error message on SIGINT
3 participants