Closed lewispham closed 8 years ago
@tresdin may I ask you to provide npm ls spdy
output here?
@indutny No problem.
That's all I have.
@tresdin thank you! May I ask you to also run npm ls spdy-transport
?
@indutny Here you are.
Thank you! Two more question to you:
DEBUG="spdy*"
environment variable and upload the output log to gist.github.com ?Thank you again!
@indutny
Chrome Version 47.0.2526.106 m (64-bit)
. Here is the result on Firefox. node /home/app/index.js DEBUG="spdy*"
but nothing else happened.@tresdin you will need to run it like this DEBUG="spdy*" node /home/app/index.js
. Thanks for testing it on Firefox.
@indutny My output log https://gist.github.com/tresdin/908a0ebf0ea67a9c9783
@indutny Sorry for the wrong log. Here is the one with this error. https://gist.github.com/tresdin/e557984ceba774853e3e
Thank you very much for detailed logs. However, I'm afraid I still need a bit more information than this.
May I ask you to open chrome://net-internals/#export
in Chrome before testing it (please make sure that you do not have any other tabs open so that they won't leak any private data), start the server, reproduce the issue, and click "Save to file" there in chrome. You may want to send the output log by email, just in case if it contains any private data (I will make sure nothing will be exposed).
Thank you again!
Nevermind, I know what is happening. Will create a fix today.
Ah, actually I was wrong. I still need that net-internals
log. Sorry!
@indutny I've sent the log to fedor@indutny.com.
@tresdin thank you! So the answer for our problem is:
Received duplicate pushed stream with url: https://hostname/app/favicon-32x32.png
I think if you will handle err
instead of re-throwing it in error
event listener - you should be able to handle it. It doesn't look like a problem on node-spdy side.
The idea behind this error message is that you actually push streams on every incoming request, and this error happens if you push the same url twice on the same TLS connection.
Thank you very much for providing the log.
@indutny
The idea behind this error message is that you actually push streams on every incoming request
This error still stands when requests are filtered.
if(req.url === '/'){
['/app/main.js','/app/main.css','/app/favicon-32x32.png'].forEach(function(url){
console.log('fetching',url);
var stream = res.push(url, {
'content-type': `${MIME[url.substr(url.lastIndexOf('.')+1)]};charset=utf-8`,
'content-encoding' : 'gzip',
});
stream.on('error', function(er) {
throw er;
});
var fstream = fs.createReadStream('/home'+url);
fstream.pipe(stream);
});
res.end(`
<!DOCTYPE html>
<html>
<head>
<script src="/app/main.js" async></script>
<link rel="stylesheet" href="/app/main.css" async>
<link rel="icon" type="image/png" href="/app/favicon-32x32.png" sizes="32x32" async>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body></body>
</html>`
);
}
this error happens if you push the same url twice on the same TLS connection
How can url be pushed twice on the same TLS connection with my sample code? And also, what is your solution for this error?
@tresdin the browser may cancel any PUSH stream if it thinks that it needs to do so (be it duplicate streams, or whatever). The solution is to handle error
event on PUSH stream, and act accordingly.
@indutny I just want to know the cause of the duplication. You've confirmed that this error is not from node spdy side. So which part of my code causes this error? Or is this a Chrome bug?
@tresdin this is not a bug at all. Browser just decides that it does not want to receive any data from that PUSH stream and cancels it. This is completely legal in HTTP2
@indutny I think it should be considered as a bug. Browsers assume that this behaviour is incorrect on server side when some duplicated streams are sent. So the problem can only be solved when browsers stop rejecting incoming pushed streams.
@tresdin I don't get why it is a bug. Please remove throw err
from your code, and it will work just fine.
I got the protocol error while I was trying to push multiple files via
PUSH_PROMISE
. Here is the sample code.Result:![untitled](https://cloud.githubusercontent.com/assets/7781091/11977359/71506264-a9b4-11e5-9b8e-f54bea0c44da.png)
Anything wrong with my code? Or is this a
node-spdy
bug?