-
Notifications
You must be signed in to change notification settings - Fork 311
Client.Ping method raises network disconnection: "use of closed network connection" #27
Comments
Yep I saw that as well a while ago in your code. The problem is, that a closing socket does NOT return EOF but *net.OpError. More information can be found here: I decided to go for this dirty hack that was proposed in the googlegroups: func IsEOF(err error) bool {
if err == nil {
return false
} else if err == io.EOF {
return true
} else if oerr, ok := err.(*net.OpError); ok {
if oerr.Err.Error() == "use of closed network connection" {
return true
}
} else {
if err.Error() == "use of closed network connection" {
return true
}
}
return false
} |
+1 Same issue here, and the IsEOF mentioned above fixes it for me as well. I changed 2 cases in sendRecv.go and 2 more in process.go - from what I can tell, the current surgemq HEAD won't work without this workaround (this is on Mac OSX 10.11.2 with Go 1.5.3, FWIW). |
sorry. |
Unfortunately this repo is labeled as Unmaintained. I will reopen the issue if the status comes back to Maintained. |
STEPS TO REPRODUCE
then, go run this code with -logtostderr -vv 3:
RESULTS
REASONS
In case of
Client.Ping()
,ackmsg.Msgbuf
is empty inservice.processAcked()
.As a result,
msg.Decode(ackmsg.Msgbuf)
panics with "slice bounds out of range".The text was updated successfully, but these errors were encountered: