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
Changes from all commits
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
4 changes: 4 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,11 @@ func (c *Conn) readLoop() {
}

frameType, data, err := ReadUnpackedResponse(c)

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.

Expand Down