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 producer Stop() EOF #201

Merged
merged 1 commit into from
Apr 15, 2017
Merged

fix producer Stop() EOF #201

merged 1 commit into from
Apr 15, 2017

Conversation

mengskysama
Copy link
Contributor

when producer.Stop() EOF exception occur


2016/12/01 09:44:47 ERR  3856 (10.160.3.70:4150) IO error - EOF
2016/12/01 09:44:47 INF  3856 (10.160.3.70:4150) beginning close
2016/12/01 09:44:47 INF  3856 (10.160.3.70:4150) readLoop exiting
2016/12/01 09:44:47 INF  3856 (10.160.3.70:4150) breaking out of writeLoop
2016/12/01 09:44:47 INF  3856 (10.160.3.70:4150) writeLoop exiting
2016/12/01 09:44:47 INF  3856 stopping
2016/12/01 09:44:47 INF  3856 exiting router

if err != nil {
if err == io.EOF && atomic.LoadInt32(&c.closeFlag) == 1 {
goto exit
}
if !strings.Contains(err.Error(), "use of closed network connection") {
c.log(LogLevelError, "IO error - %s", err)
c.delegate.OnIOError(c, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

@mreiferson @jehiah Should it check c.closeFlag if the error does contain "use of closed network connection"? Otherwise, it might skip a call to c.delegate.OnIOError which delegates to (p *Producer) close(). It's not immediately obviously what conditions inside the net package can lead to net.errClosing.

Copy link
Member

Choose a reason for hiding this comment

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

My assumption is that there's an edge case where you're cleanly shutting down but you don't "use a closed connection" but instead hit an "expected" EOF.

This person was clearly getting a log message despite the existing logic, which I think confirms that.

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.

3 participants