molnarg / node-http2

An HTTP/2 client and server implementation for node.js
MIT License
1.79k stars 187 forks source link

Silently fails to send over closed connection (client) #224

Open ashimoon opened 7 years ago

ashimoon commented 7 years ago

After a server closes the connection, the connection is marked as closed, but the connection is kept in the endpoint[key] cache.

Later requests to send data over that connection fail silently (Connection.prototype._send checks _closed, silently returns).

This manifests itself in some number of requests succeeding, and then suddenly no more requests succeed, with no error.

I've fixed it locally by having the connection emit a new event "closed". Endpoint re-emits this event, and Agent finally handles it by removing the closed endpoint/connection from Agent.endpoints.