-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving a RST_STREAM on a pushed stream causes a crash #107
Comments
I'm getting this bug as well, when I'm requesting several dozen files via XHR in chome, and then stop the page loading. |
I got a similar error while I was trying to push multiple files with this code.
|
I'm reproducing this issue consistently with browser cached resources, and intermittently when the resources aren't cached. So, I agree that this is probably a race condition. My issue occurs with one file or multiple files. I've only tried on Chrome. It seems that the client is trying to cancel the pushed stream by sending a RST_STREAM frame to the server. I just don't really know how to handle that. Is there documentation somewhere? Seems like I should be able to receive that and send back a 304 status somehow. Regardless, it is crashing the server - so, I'll look forward to any conclusion. This is what I see in the log:
And this is my code: function onRequest(request, response) {
if(response.push) {
FILES.forEach((file, index) => {
let push = response.push(file.path);
push.writeHead(200, file.headers);
fs.createReadStream(path.join(__dirname, file.path)).pipe(push);
if(index === FILES.length - 1) response.end(Template.output(FILES));
});
}
} |
I have found a workaround for this which is showing some interesting results. In particular, I am failing on one specific file, which is supposed to being loaded as a background image in css, and my app itself is not showing this image. Anyway, the workaround
By putting on 'error' on the push.stream variable it catches the errors and allows me to continue. I am now regularly pushing 14 files when I see a request for '/' or '/index.html' and its normally one of the early files (the background image) that is failing. |
Prevent exceptions for the common case in which the serving endpoint sends frames after the RST_STREAM has been sent from the client endpoint. Often frames are enqueued prior to the arrival of the RST_STREAM, but sent after. This should be expected based on HTTP/2 spec, section 6.4. https://http2.github.io/http2-spec/#rfc.section.6.4 "However, after sending the RST_STREAM, the sending endpoint MUST be prepared to receive and process additional frames sent on the stream that might have been sent by the peer prior to the arrival of the RST_STREAM."
I have been conducting some tests with different browsers to see where things are. I have altered my application so I can switch push on and off with a simple environment variable change. When push is turned on I push about 40 files when I first load the application (index.html), and then another 10 or so when the user cookie has been checked and the application requests the element (a custom web component) that controls all the pages of the application. With push turned on: Linux Chrome: Works almost perfectly, occasional failures whilst pushing (using the on error callback as shown above). I also sometimes, but the majority of the time not, then experience the crash With Push turned on and @adamhenson fix #107 applied The two Windows browsers (Firefox and Edge) that got stuck now no longer get stuck With Push Notifications turned off All browsers in all environments work. Given a primary aim is to support IPads I will have to leave push turned off for now (at least until Apple's performance improve), but I would like to know what to do to detect the inability of a browser to handle push, both in general - and when I have pumped too much at them. |
I am not even pushing anything. just the regular request response and i get this. |
Me too, I am not pushing anything, just fastly making several regular requests:
I got this:
|
Prevent exceptions for the common case in which the serving endpoint sends frames after the RST_STREAM has been sent from the client endpoint. Often frames are enqueued prior to the arrival of the RST_STREAM, but sent after. This should be expected based on HTTP/2 spec, section 6.4. https://http2.github.io/http2-spec/#rfc.section.6.4 "However, after sending the RST_STREAM, the sending endpoint MUST be prepared to receive and process additional frames sent on the stream that might have been sent by the peer prior to the arrival of the RST_STREAM."
Fixes molnarg#107: Allow frames after RST_STREAM.
Prevent exceptions for the common case in which the serving endpoint sends frames after the RST_STREAM has been sent from the client endpoint. Often frames are enqueued prior to the arrival of the RST_STREAM, but sent after. This should be expected based on HTTP/2 spec, section 6.4. https://http2.github.io/http2-spec/#rfc.section.6.4 "However, after sending the RST_STREAM, the sending endpoint MUST be prepared to receive and process additional frames sent on the stream that might have been sent by the peer prior to the arrival of the RST_STREAM."
This happens when Firefox refuses a pushed stream (using RST_STREAM), either because of configuration (disabling network.http.spdy.allow-push) or because of a bug in firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1127618). Presumably, this happens with any other UA that refuses pushes in a similar fashion.
My first suspicion is that there's a race between receipt of the RST_STREAM (which sets the stream state to CLOSED) and stopping sending of data on the pushed stream that causes us to hit this state, but I have to investigate further to be sure.
The text was updated successfully, but these errors were encountered: