Now, back to our goroutine, we're trying to send message to c channel. But since that channel is read by no one now, we stuck here forever.
Described situation may seem rare, but in our project with hundreds events per second that leak happened rather often. We tested this fix in production environment and it solved the problem.
We have goroutine leak here if events will happen in following order:
responses
channel, but didn't send it toc
channel yetgraphql-ws-transport
stopped readingc
channel (https://github.com/graph-gophers/graphql-transport-ws/blob/master/graphqlws/internal/connection/connection.go#L233-L235)c
channel. But since that channel is read by no one now, we stuck here forever.Described situation may seem rare, but in our project with hundreds events per second that leak happened rather often. We tested this fix in production environment and it solved the problem.
@pavelnikolov