idea: for streaming responses, send an email on error
so, our worst stream response failures have been hangs and spins so far, but still some of them are just plain crashes that we actually have stack traces for. these land in sentry, but our users usually think the server is just taking forever to work on it.
possibly for these particular responses sending the user an email with the error and a stack trace and a link to the forum could be a good idea.
That seems like a great idea. Could we also consider triggering a service restart?
i don't think it'll do anything. i get why you're saying that but that wouldn't help in any case this would catch.
I see this issue is marked "needs discussion", but it's sounding like this is something we want to do. @lognaturel, what do you think about removing "needs discussion" and adding "help wanted"?
It would be helpful to get some specific examples of failures.
I think all streamed responses are written with Transfer-Encoding: chunked, which should allow clients to detect and handle broken streams. I can't find this explicitly documented, but it's implied at https://nodejs.org/api/http.html#http_request_write_chunk_encoding_callback.
In addition to this, zip streams should fail to decompress if not downloaded completely, as they will be missing the "end of central directory record".
There have been a number of improvements around stream timeouts recently, which may also be relevant.
ERR_STREAM_PREMATURE_CLOSE may be related, but so far I've only seen that occur when the client disconnects unexpectedly. In that case, the user may be aware that their connection is inactive or unreliable.