-
Notifications
You must be signed in to change notification settings - Fork 106
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
Metadata key contains illegal characters #415
Comments
Just confirming I'm seeing this frequently as well, but also not reproducibly. Retrying the request in question almost always succeeds. It happens regardless of whether there are simultaneous parallel requests. Our project contains |
I think we'll be forced to downgrade to |
@alexander-fenster I wonder if this could relate to our upgrade to |
It's probably not, cause we did this sequence of things:
ps: After I've just written this, I realized I'm not 100% sure. Tried to trace changes via |
@kirillgroshkov @kmontag The main difference between v3.x and v4.x under the hood is the replacement of the original The good news is that you can keep using the C++ npm install grpc const grpc = require('grpc'); // not '@grpc/grpc-js'
const {Datastore} = require('@google-cloud/datastore');
const projectId = 'YOUR_PROJECT_ID';
const datastore = new Datastore({
projectId,
grpc // <-- passing it down to the client
}); I would really appreciate it if you folks try that and update this issue with the results (e.g. if the errors disappear or not). This will help us report a bug to gRPC developers. Thanks! |
@murgatroid99 @nicolasnoble This is FYI for now but will likely be upgraded to a real |
A quick clarification: please upgrade back to v4.0.0 before substituting |
At the moment, the best possible thing to help figure this out would be a |
Also, it might be helpful to share a more complete list of the error messages with different metadata keys, possibly in a Gist. |
@murgatroid99 I'm seeing these fairly regularly. How would one get a tcpdump of datastore traffic without TLS? Just to the datastore emulator right? I've started a gist and I'll update this as I go along today. https://gist.github.com/chrishiestand/4c8a7b36e93cbddbafd09a53be113d08 |
If you can reproduce this with the datastore emulator, that might be even better. Then I could probably take the tcpdump myself. |
I am seeing this error using Firestore specifically firebase-admin 8.0.0 under NodeJS 10. Metadata key "@���" contains illegal characters at Http2CallStream.call.on (/app/node_modules/@grpc/grpc-js/build/src/client.js:101:45) at Http2CallStream.emit (events.js:203:15) at Http2CallStream.endCall (/app/node_modules/@grpc/grpc-js/build/src/call-stream.js:63:18) at ClientHttp2Stream.stream.on (/app/node_modules/@grpc/grpc-js/build/src/call-stream.js:194:30) at ClientHttp2Stream.emit (events.js:198:13) at emit (internal/http2/core.js:236:8) at process._tickCallback (internal/process/next_tick.js:63:19) |
@klon Please follow my advice from the above comment #415 (comment) to use the C-core Alternatively, if you could help gRPC team (@murgatroid99) debug the issue by providing the non-encrypted dump of the data, it will be really appreciated. Thanks! |
@alexander-fenster Thanks for your reply. Why would you introduce grpc-js to a production library when it clearly says "Note: This is an beta-level release" in the grpc-js readme? |
@klon This is a valid question. To answer your question: this is not some external library we randomly started using for no reason, it's a library we develop and is supposed to be a replacement of the existing It's indeed marked as beta, but it still makes sense to use it and not It's sad to see that this particular edge case was not caught by our tests. Bugs do happen, we apologize for this inconvenience this caused for you and other folks in this thread. This bug would've likely happened even if I guess we could've done somewhat better job communicating this change (that happened within our latest semver major release) and explaining a way to rollback to Thanks! |
This issue should have been fixed by googleapis/gax-nodejs#521. Can this issue be closed? |
Thanks @chrishiestand! I'll try that. Can I ask you to make the following change to the grpc-js code right inside your --- node_modules/@grpc/grpc-js/build/src/call-stream.js.orig 2019-07-10 15:22:19.048842980 -0700
+++ node_modules/@grpc/grpc-js/build/src/call-stream.js 2019-07-10 15:22:41.096762637 -0700
@@ -200,6 +200,7 @@
metadata = metadata_1.Metadata.fromHttp2Headers(headers);
}
catch (error) {
+ console.log('Bad headers:', headers);
this.endCall({
code: constants_1.Status.UNKNOWN,
details: error.message, That way it will dump the headers that failed to parse, and at least we'd know if they make any sense or are just a garbage. If you happen to get those headers, please check if they contain any private data before pasting it here, and feel free to obfuscate / strip everything. |
@chrishiestand Sorry it wasn't a reference to the original problem but the one mentioned by @kirillgroshkov |
|
Aha! Thank you so much! @murgatroid99 Does it make any sense for you? Is it something in Node.js http2 stack, or something that gRPC server sends? I suggest, while we're investigating, let's just start ignoring bad metadata keys at that place. Receiving an invalid metadata key from server is something we (in the gRPC client or in a client library) cannot do anything about, so throwing an exception might be an overreaction. |
@chrishiestand Can I ask you to dump some examples of good headers (with no failure) as well, just to compare the good ones vs the bad ones? (just put the same |
@alexander-fenster here's the headers from a single function call
|
If you ever see a headers block with one of the bad strings that doesn't have a lot of zeros (like |
I'll update this comment as they come in:
|
I have published grpc-js@0.5.2 with Alex's suggestion: now these invalid keys will cause a warning to be emitted instead of an error, and the call will continue to be processed. I am very curious to see if anyone gets multiple warnings from a single process and, if so, whether they have anything we haven't seen so far. |
Since grpc-js is in 0.x range, v0.5.2 won't be pulled automatically since google-gax depends on |
This fix includes grpc/grpc-node#962 which is a work around for a bad metadata keys problem that many customer see across several libraries (googleapis/nodejs-datastore#415, googleapis/nodejs-logging#527, googleapis/nodejs-pubsub#667 are just a few).
This fix includes grpc/grpc-node#962 which is a work around for a bad metadata keys problem that many customer see across several libraries (googleapis/nodejs-datastore#415, googleapis/nodejs-logging#527, googleapis/nodejs-pubsub#667 are just a few).
@kirillgroshkov @kmontag @klon @csidell-earny @chrishiestand Hey folks, We have released @chrishiestand Thank you so much for your help with debugging! |
After doing
It says I have 2 different versions of Is this correct? I would expect that you bumped it there too |
@kirillgroshkov Technically you're right and we need to bump it here as well (@bcoe can you please do it?), but if you check how it is used, you'll see it's here just for TypeScript types and no actual code from |
Deployed it yesterday. So far 0 errors, looks promising. |
@kirillgroshkov Are you able to see any warnings ( |
This issue has been hitting us too for the past 20 days (around 2500 occurrences of that error so far that I can tell), so we'll try to update and see if it fixes the issue at our side too. |
I'm unable to check console logs in our current system. But 8 days since my last post - it runs stable, original issue is not reproduced since. |
It is fixed in out application too. We see no more of these:
however, we apparently traded it for a different Error now:
which is happening since that update. |
Seeing the same. It happens very frequently now too so really unsure what to do. Testing with @hermanbanken any luck since your last comment? @JustinBeckwith @schmidt-sebastian is this related to: firebase/firebase-functions#536 (comment) |
The amount of occurrences those new errors is much lower, so it is kind of an improvement. The |
Your fix was to bump
I dropped back down to 3 and am not seeing issues in the last hour or so |
This sounds like the same issue that we fixed in googleapis/nodejs-firestore#697. The fix was to update google-gax to 1.1.2. I am however not certain that it will be a drop in replacement here since your dependencies still shows gax at 0.25.6. |
We've started noticing a new error in production (and in staging env also) that happens ~50 times a day for us (for many thousands or maybe even millions of calls per day, don't have exact number). It looks like this in a stacktrace:
I've even seen this error myself once while calling a certain endpoint that was doing 1 query and 2-3
getById
calls to Datastore. So, nosave
s was made, only querying.This error is not reproducible all the time, as I mentioned, rather "rare", but still noticeable (~50 hard errors every day, that end up in http 500 errors for our api users).
I don't know how to dig further and provide other helpful info. Important to note that it only happened after updating from
^3.0.0
(latest version in 3.x.x) to4.0.0
. I'm assuming the error could somewhere downstream (ingrpc-js
itself) that was updated as a sub-dependency. We're on the latest version of everything as of today (yarn upgrade
was done and we have no deps pinned).ps: forgot to add that the "key" in the metadata has different values in each other error (we see it in Sentry), examples (
err.message
here):pps: we were using
.runQuery()
method with 2 simple filters bynumber
fields and.get(key)
(that's what I calledgetById
). Same code in3.x.x
version worked just fine.Noticed that
a
occured more often than others.Environment details
@google-cloud/datastore
version: 4.0.0The text was updated successfully, but these errors were encountered: