BUG in main receive loop - it does not finish after TCP connection was closed #84
Labels
No labels
breaking-change
bug
dependencies
duplicate
enhancement
go
good first issue
help wanted
invalid
investigation
proposal
proposal-accepted
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nemith/netconf#84
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implementation
In recv() method that is started as a separate goroutine the loop is supposed to stop when io.EOF or io.ErrUnexpectedEOF error is received, however even though connection was successfully closed (for tcp connection) that is not a case and error "use of closed network connection" is printed the whole way through the run of the program suggesting therefore that the recv() method never finishes it's run.
Recognizing connection termination as implemented in apimachinery library
In apimachinery/pkg/util/net/http.go function IsProbableEOF was implemented that besides recognizing connection termination by receiving error io.EOF or io.ErrUnexpectedEOF analysis also other errors that "resemble a connection termination". The function in question:
Suggested fix
To fix the described bug I would suggest adding either one new condition for "use of closed network connection" error (which is the bug that I found) or to implement the whole function with all listed error messages so that recv method resembles this: