-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
http2 throws ERR_HTTP2_INVALID_STREAM with minor amount of concurrency #1229
Comments
One thing that may be different from the Node.js issue is that your non Koa test did not use the http/2 compat mode while Koa will use the compat mode. It just makes me wonder if the issue is in Node.hs core in the compat mode code perhaps. |
Hm, do you know how I would test that? All I see about a compatibility API here is that there's a non-TLS Edit: Nevermind, the |
This would be an example server.js file: const crypto = require('crypto');
const fs = require('fs');
const http2 = require('http2');
http2.createSecureServer(
{
allowHTTP1: true,
cert: fs.readFileSync('cert.pem'),
key: fs.readFileSync('key.pem'),
secureOptions:
crypto.constants.SSL_OP_NO_SSLv3 |
crypto.constants.SSL_OP_NO_TLSv1
},
(req, res) => {
setTimeout(() => {
res.statusCode = 200;
res.setHeader('Content-Length', '5');
res.setHeader('Content-Type', 'text/plain');
res.end('balls');
}, 5000);
}
).listen(
31337
); I am trying on my end, but I didn't get any error with any of your examples (or mime above) with Node.js 10.8.0, though I am on the Windows platform, which may play a role in the difference. |
Got it, thanks! I pasted more or less the same thing in the other thread for reference, but I wasn't able to reproduce the issue using the compatibility API without koa. Switching back to the original test with koa still reliably produces the error for me. |
Darn, it was worth a shot. Perhaps a member with a similar platform to yours will be able to take a look 👍 |
It might be reproducible in Docker on Windows (I'm using Docker on OS X right now with the Edit: Relevant command: And within Docker:
|
Yea, I noticed you had Docker listed. I don't have it installed and about to head to sleep for the night. If no one else stops by I'll take another stab with Docker. |
@buu700 did you manage to solve this issue? Here a small repro:
The plain http2 server works fine, but the koa+http2 server kills the process because of a SIGINT: it's like koa is trying to send content over a closed stream because the process dies after koa processed the request (the "curl" actually receives data but in the meanwhile node dies!).
|
Nope, as far as I'm aware there's no way around this. I'm just temporarily using the older |
Is this a Koa problem or a problem of the |
It seems to be Koa-specific based on the issue linked at the top. |
I was trying to do the same but express does not seem to support http2 if not with hacks.
Throws:
Not sure though this is the proper way to use express + http2 |
FYI: adding a 50ms delay Is anyone actively investigating on this...? |
@damianobarbati what node version are you using and how do you launch your repro code? Naively running it like this does not work:
|
@edevil Node version:
Deps:
|
FWIW I also managed to reproduce this issue after sending a bunch of requests:
Using the 8444 port (no Koa) I was not able to crash it. |
This issue seems like a race-condition. Like @damianobarbati mentions, the |
I've fixed the issue in Node, and the PR has been merged. nodejs/node#23146 If anyone wants to try they can build the latest |
Did anyone have a chance to verify the fix? |
I am going to close this issue as the PR is merged and released and nobody has raised concerns/question about this since late 2018. |
Moving from nodejs/node#22135; as per the comments, it was confirmed to be koa-specific.
v10.8.0
Linux 86f664ae731c 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
(ubuntu:18.04
Docker image)http2
After a small handful of concurrent requests, http2 fails with the following error:
Test case:
When the error occurs, you can manually kill the command with ctrl+C and
wc -l count
to view how many requests were initiated before the failure. For me it's been anywhere between 10 and 70.This doesn't seem to be reproducible when using either
https
orspdy
instead ofhttp2
.The text was updated successfully, but these errors were encountered: