-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
There appears to be a bug with the http2 header decoding #28632
Comments
Do you happen to have some kind of reproduction for this? |
Unfortunately, not yet. I was hoping that someone more familiar with the implementation might be able to see what the error is from the information I have. |
@murgatroid99 Okay – this is happening on the client side and it is only happening with the |
@addaleax
I can't confirm this being a client side bug either - we are using Google PubSub. Platform: node: 8-stretch (docker) image (one instance on 10-stretch) |
@pworkpop I guess the same question goes for you then – do you have some kind of reproduction? |
@addaleax unfortunately not, we are battling some connection issues that surface as deadline exceeded errors in PubSub so it may well be the servers sending the invalid key |
one thing you can potentially try is setting up Wireshark to intercept the HTTPS secured HTTP/2 traffic flowing into the endpoint. Obviously that depends on your set up, but it would be interesting to see if the headers coming into our Header handling code are correct. Given the kind of corruption that is occurring in the examples, it almost looks like the pointers could be uninitialized, which means our ref counting may be off and nghttp2 could be freeing the buffers earlier than expected. That shouldn't be possible with the current implementation unless there's definitely something wrong and we very likely would have seen the bug crop up previously. If we can rule out errors in the inbound data, then that would help in lieu of a reproducible test case |
Is this problem also present in node 12 ? |
I'm not sure. We've had multiple recent reports of this error but they haven't specified the Node version. |
Sounds like an encoding issue with a child dependency, not NodeJS. It does look like it's fixed now: googleapis/nodejs-datastore#415 Edit: Unless we want NodeJS to do the urlencoding... |
I don't think that gax-nodejs PR is at all related to this bug. And people have reported the bug to us much more recently than the last update in either of those issues, so I don't see any reason to think that this is resolved. |
@murgatroid99 You might be right. The error is likely coming from: Do you have an exact version of what version of |
To be clear, I am the author of |
@murgatroid99 Yeah I saw you name in the source code and realized that after I commented. 😅 Yeah, so it's either:
It's curious that it's always a short 3-4 character header. If I were to take a guess, I'd say I don't know if we have a test for Another thing that may be possible is that the reference to the header name exists inside dynamic table, and an awkward timing of events may cause the dynamic table to be different when the |
Actually, I read the spec wrong. The |
As I said in the beginning of the issue, my guess is that this header is represented as "Literal Header Field Never Indexed — Indexed Name", because the header name "date" is in the static table without a corresponding value. Among the headers listed in the initial issue, |
We can't exclude the possibility that the client is sending it corrupted. NodeJS's HTTP2 client doesn't even have the ability to send a header with
@jasnell Aren't we missing a Line 2210 in f63436d
|
This error is happening on the client, and it has been reported with non-Node.js servers. So we can't assume anything about what kinds of header encodings the sender can use. |
@murgatroid99 Sorry, I see. I was misinterpreting this as a server environment. In either cases, NodeJS isn't able to send request headers with the never-index flag. It seems as though |
The error in question is on response headers received by a Node client, sent by a different server. Those could be using any header encodings. |
@murgatroid99 Yes. It's just that since NodeJS can't send |
If |
So, I've manually traced the events as:
To my understanding, on inflated headers |
@clshortfuse Thanks for looking into this so thoroughly! Maybe I’m missing something, but the |
@addaleax I don't think Lines 495 to 498 in 241ed44
It's very possible that on Yes, it's more efficient to hand over all the headers to JS once we're done getting them all, but seems like that won't work with inflated Edit: Increment buffer count, not increase buffer |
@addaleax Confusingly, despite its name, |
To be clear, this is what I’m referring to here:
i.e. yes,
Not if it’s called without an argument. |
I guess I was wrong about not being called. I missed the I don't see why node/src/node_http_common-inl.h Lines 122 to 127 in f89530f
But I don't think it really matters. I'll have to check another venue. Maybe I'm on the wrong track about the |
Yeah, me neither. 😄 |
This comes from googleapis/nodejs-datastore#415. It looks like occasionally http2 headers objects are being provided from the
http2
module with invalid and clearly incorrect header keys. For example, some bad headers objects look like thesewhile valid headers look like this:
In all of the cases we have seen, it looks like the
date
key is replace with this garbled nonsense. My guess is that it is relevant that that header is the one most likely to be encoded in the format Literal Header Field Never Indexed — Indexed Name because the value changes with every request.The text was updated successfully, but these errors were encountered: