-
Notifications
You must be signed in to change notification settings - Fork 195
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
Assertion error when using server push #285
Comments
Have same issue. spdy:priority add node=195 parent=0 weight=256 exclusive=1 +36ms { AssertionError: false == true Happens when I press f5 several times quickly ( I use push ). |
I seem to have the same issue, the initial request + pushed files are fine but any requests after that seem to trigger the same assertion error. This only occurs if I hit refresh multiple times or when my service worker does a lot of requests simultaneously.
I'm using the on error callback but the AssertionError still triggers a fatal error on the server. I've disabled push for now |
Hi all, thanks for reporting this one. It would be super helpful if you could provide a test that fails for this case, do you think you can come up with one? Thanks! |
I'm also having the same issue as described here and in #285. I.e. when using push I get an Output of "DEBUG=spdy:priority" up until assertion error: Click to expand
My push related code: let pushedStream = res.push(pushResrcPath, {
status: 200,
method: "GET",
request: {
accept: "*/*"
},
response: {
"content-type": mime.lookup(pushResrcPath)
}
});
pushedStream.on("error", (err) => { console.error("Push stream failed", err); });
pushedStream.on("finish", () => { console.log("Push stream finished."); });
let fileStream = fs.createReadStream(path.resolve(__dirname, path.join("../path/to/public/", pushResrcPath.replace(/^\/someprefix/i, ""))));
fileStream.pipe(pushedStream);
FWIW: I'm using Node.js v6.9.1 in combination with Express v4.15.2 on Windows 10. |
I can replicate this reliably by pushing many assets, which I think simulates the action of this constantly refreshing people are reporting. Here's my example, perhaps someone could form this into a test case for @diasdavid if it doesn't help on it's own? |
The following single-file example also causes the AssertionError to be thrown on my development machine. const spdy = require("spdy");
const options = {
key: `-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA7aSwMfFw5naEJ6MlTS53cYrnkF6DyrQuHWMOTOgtEfY1XWjrHEUdfz4xvn4/LAOWpsFP/YkIaYHlLAez3ZybjEaSH/T/jqpDmO4VSbSfdxzJJHV8sTO7G6gtHkGFiDMOKCBDi1Htrx7e8kY39c8j5ZFfS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QsFAAOCAQEAb4AIPuALBtOEDMhIi2wRDt9b88XewLJDejkl8o1GRs0FlknvYh+wawe4FuZqBhso6Mi/INqWsmFQbQWXX5PGyFhtw1wsGLJ7el+2Tmv3frGTxAJnhmouu60b1Vh8r9jGvbYn4Kdo7+5YrfuUbebl/RuOjYTcom4QdMMehXiWADMrSAa/7SZmKhODskWyRgLFMUsDe8UHJt/8HVgVila9GIVXY/Toq+JMFTU7oEydW2DohrOvERUpx/VnVVwH89AdM1tUDM0sgsSWoM69R+g6cFtMg8/HqSWYrPw0+jACpSgZ8ekYMPk55gYWKccoK8K+DCaFJVQhu0S1FhzTNRw/og==
-----END CERTIFICATE-----`,
spdy: { protocols: ["h2"], plain: false }
};
let htmlContent = `<html><head><title>Push error page</title><link rel="stylesheet" href="css/main.css"></head><body>`;
for ( let i = 0; i < 100; ++i ) {
htmlContent += `<img src="img/img${i}.svg">`;
}
htmlContent += `</body></html>`;
const cssContent = `body { background-image: url("../img/hero.svg"); background-size: cover; background-color: gray; } img { float: left; padding: 1vh; width: 5vw; }`;
const heroSvg = `<svg width="25" height="25" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="grad" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="black"/><stop offset="1" stop-color="darkgrey"/></linearGradient></defs><rect width="25" height="25" fill="url(#grad)"/></svg>`;
function requestHandler(req, res) {
if ( req.url == "/" || req.url == "/index.html" ) {
let pushStream = res.push("/img/hero.svg", {
status: 200,
method: "GET",
request: { accept: "*/*" },
response: { "content-type": "image/svg+xml" }
});
pushStream.on("error", (err) => { console.error("Push stream error:", err) });
// IMPORTANT If we don't introduce a (not-too-low) delay here, then the push AssertionError doesn't seem to be thrown. (On my PC the delay needed to be > ~20ms.)
setTimeout(() => {
pushStream.end(heroSvg);
}, 100);
res.writeHead(200);
res.end(htmlContent);
} else if ( req.url == "/css/main.css" ) {
res.writeHead(200, { "content-type": "text/css" });
res.end(cssContent);
} else if ( req.url.startsWith("/img/") ) {
// Note: If we wouldn't push "hero.svg" it would also be served as a randomly solid color filled rectangle.
res.writeHead(200, { "content-type": "image/svg+xml" });
res.end(`<?xml version="1.0"?><svg width="25" height="25" xmlns="http://www.w3.org/2000/svg" version="1.1"><rect width="25" height="25" fill="rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})"/></svg>`);
} else {
res.writeHead(404);
res.end();
}
}
spdy.createServer(options, requestHandler).listen(3000);
console.log("Server running @ https://127.0.0.1:3000/"); One important thing to note is that for the error to occur I had to introduce an artificial delay for the response of the push by using (Note: The included key and (self-signed) certificate were generated just for the example.) |
Any updates on this? |
Any update on this issue? What might be causing this issue? |
Same here. After hitting browser refresh few times i got same error. Any updates on this? Or we would not be able to use push for ages because it seems like this issue is quite old. It |
Following the server-push example, I am using a slightly adapted version:
When refreshing the browser a couple of times in a row, I get the following assertion error:
Note that the server-pushed file is relatively large (4MB).
Might this be related to the closed issue #244 ?
I'm using Express as well btw.
The text was updated successfully, but these errors were encountered: