Open cpg opened 10 years ago
This continues to be a problem. When something happens upstream and things get disconnected at any point, some goroutines are left dangling. We need better error caching for non-mainstream cases like this.
I'm not too familiar with the library and I've kinda just spent an hour looking around it, but what it looks like to me is that in stream.go:558
(where panic happens) there is a missing check for if the session is closed:
...
// Write the frame
sr := frameSynReply{session: s.session, stream: s.id, headers: s.headers}
debug.Println("Sending SYN_REPLY", sr)
s.session.out <- sr
s.wroteHeader = true
...
If the stacktrace is pointing to the correct lines of code, then it might be the case. A check if s.session.closed
is true might be what this needs, but this method does not return an error, so I'm not sure how that should be approached. Either way, I'm not sure if there is anything in the code that can cause the session to be closed before WriteHeader
is called. Perhaps someone who knows the code better could answer that :)
We have seen an error of this kind. It took several days into seeing this error in a production system. It's not readily reproducible. In any case, this is what happens: