spdy-http2 / node-spdy

SPDY server on Node.js
2.8k stars 196 forks source link

How to debug Safari failure: "An error occurred trying to load the resource." #230

Closed marcello3d closed 8 years ago

marcello3d commented 8 years ago

I'm using spdy.createServer as a drop-in replacement for https.createServer.

We've been getting a random problem in Safari (on OS X and iOS) where only the first 64KB of javascript files seem to be sent (served up by express + serve-static). Safari shows this as An error occurred trying to load the resource. in the web inspector. It does indicate that it used HTTP/2.0.

The problem doesn't seem to happen when I use https

I'll see if I can make a stand-alone test case, but in the meantime, any advice on how to debug this? Any gut feelings on whether this is node-spdy or Safari's fault?

Thanks.

indutny commented 8 years ago

Hello!

May I ask you to provide a debug output for me, please? You may get it by setting DEBUG="spdy*" in your environment variables and running the test. I suggest to post it as a gist though, because the output will very likely be quite big.

Thanks, Fedor.

marcello3d commented 8 years ago

Alright, this is the log for manually requesting the .js file in safari (as opposed to the whole page) that resulted in the error (and only 64KB being downloaded).

https://gist.github.com/marcello3d/339ac9e1d4a2094db4ac

I removed some logging with respect to cookies/authentication.

marcello3d commented 8 years ago

We're also seeing this on chrome, one of our devs got net::ERR_SPDY_FLOW_CONTROL_ERROR in the JS console. Haven't reproduced that one yet so not sure if it's also happening at the 64KB mark.

indutny commented 8 years ago

@marcello3d I will look more into it this week (sorry didn't have time yet). Meanwhile, if you have some resources - may I ask you to provide a test case that reproduces the problem?

indutny commented 8 years ago

Actually, this one reproduces it:

var buf = new Buffer(64 * 1024);
buf.fill('A');
buf[buf.length - 1] = 'X';

spdy.createServer(options, function(req, res) {
  res.end(buf);
}).listen(1443, function() {
  console.log(this.address());
});
indutny commented 8 years ago

Argh, my bad! Looks like default window size is 65535 in HTTP2, as opposed to 65536 in SPDY. Fixed in spdy-transport@1.1.11 . Please run npm update, it should fix it!

Sorry for delay.