GeezerVison is showing github.com — RetryRequest not handling grpc errors · Issue #2328 · googleapis/google-cloud-node
RetryRequest not handling grpc errors #2328Labels api: pubsubIssues related to the Pub/Sub API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionWe've been seeing this in our logs several times a day:
TypeError: requestStream.end is not a function
at resetStreams (/app/node_modules/retry-request/index.js:79:23)
at retryAfterDelay (/app/node_modules/retry-request/index.js:103:7)
at ClientReadableStream.onResponse (/app/node_modules/retry-request/index.js:115:9)
at emitOne (events.js:96:13)
at ClientReadableStream.emit (events.js:191:7)
at ClientReadableStream._emitStatusIfDone (/app/node_modules/grpc/src/node/src/client.js:204:12)
at ClientReadableStream._receiveStatus (/app/node_modules/grpc/src/node/src/client.js:180:8)
at /app/node_modules/grpc/src/node/src/client.js:592:14
I'm not sure what triggers the underlying stream error, but emitting an error in _emitStatusIfDone does trigger it consistently.
Environment details
- Node.js version: 7.9
- pubsub-version: 0.11.0
Activitystephenplusplus commented on May 23, 2017 Thanks for reporting -- do you know which Pub/Sub call is likely to be the problem one? pkriete commented on May 23, 2017 ContributorAuthor More actions Hmm, I'm afraid the logs currently don't have enough context. If anything I should add that there's a chance it's file storage, which we use as a fallback for very large pubsub payloads.
I'll try to get a bit more context into our logs. I can say that it's happening on both sides, but it's a lot more frequent on the receiving end (we use pull). So it's unlikely to just be a single call. stephenplusplus commented on May 23, 2017 I just put out a fix in [email protected], so it should automatically install if you update your dependencies. Thanks for the debugging information-- I think the way it is now is the way it should have been, in that it now only calls end() if it exists: googleapis/retry-request@0eb37ca
If you still run into the issue (or side effects from this change), please let me know. Sorry for the trouble! pkriete commented on May 23, 2017 ContributorAuthor More actions Awesome, we'll give it a shot, thanks for the quick fix! pkriete commented on May 24, 2017 ContributorAuthor More actions So that definitely helped, but still getting occasional pubsub wonkiness that I don't believe I was seeing before, but may have been masked by the frequency of the other:
ReferenceError: Null is not defined
at eval (eval at __.getType (/app/node_modules/arguejs/argue.js:203:12), <anonymous>:1:1)
at Function.__.getType (/app/node_modules/arguejs/argue.js:203:12)
at Function.__.belongs (/app/node_modules/arguejs/argue.js:242:19)
at __ (/app/node_modules/arguejs/argue.js:29:13)
at Client.makeUnaryRequest [as acknowledge] (/app/node_modules/grpc/src/node/src/client.js:383:16)
at Object.request (/app/node_modules/@google-cloud/common-grpc/src/service.js:290:39)
at makeRequest (/app/node_modules/retry-request/index.js:97:28)
at retryRequest (/app/node_modules/retry-request/index.js:61:3)
at PubSub.GrpcService.request (/app/node_modules/@google-cloud/common-grpc/src/service.js:312:10)
at PubSub.request (/app/node_modules/@google-cloud/pubsub/src/index.js:779:40)
at Subscription.ack (/app/node_modules/@google-cloud/pubsub/src/subscription.js:468:15)
at /app/node_modules/@google-cloud/common/src/util.js:753:22
at Subscription.wrapper [as ack] (/app/node_modules/@google-cloud/common/src/util.js:737:12)
And in case it helps / is related, we're seeing a fair amount of another error in the retryRequests library in our bigtable code:
TypeError: Cannot read property 'pipe' of null
at onResponse (/app/node_modules/retry-request/index.js:137:18)
at emitOne (events.js:96:13)
at ClientReadableStream.emit (events.js:191:7)
at ClientReadableStream.<anonymous> (/app/node_modules/@google-cloud/common-grpc/src/service.js:395:16)
at emitOne (events.js:96:13)
at ClientReadableStream.emit (events.js:191:7)
at /app/node_modules/grpc/src/node/src/client.js:580:14
Happy to break either of these out into their own issue if they're unrelated, don't want to needlessly confuse this one. stephenplusplus commented on May 24, 2017 That is very strange. Without knowing specifically what to ask-- is there anything unusual about the environment the code is in or the way the modules are installed / required? Looking at our code execution paths, it's hard to see how retry-request could end up where it is with those errors.
It would definitely help if we could track down at least one specific call that starts the failure chain. I'll re-open this issue until we can figure out the right way to proceed. pkriete commented on May 24, 2017 ContributorAuthor More actions Nothing unusual about the node environment. A standard docker container with node:7.9 on GKE. Modules are npm installed and loaded from node_modules.
I did quite a bit more digging and I think I have at least found the cause of the second error. It happens frequently after an insert call on our table with a very large row (several MBs).
That request errors, hits the numNoResponseAttempts conditional, resets the delayStream to null and starts the timer. While that timer is running the grpc metadata event fires and emits the fake successful response, which hits that line of code while retryStream is null. stephenplusplus commented on May 24, 2017 Thank you very much for doing that work. It sounds like this might work: googleapis/retry-request#11 -- please let me know your thoughts! stephenplusplus commented on May 25, 2017 We seem to have found a solution over on googleapis/retry-request#11, and a new release of retry-request is out -- new and updated installs of google-cloud[/*] will pick these changes up automatically.
@pkriete do you think we still have the other issue you mentioned (ReferenceError: Null is not defined)? pkriete commented on May 26, 2017 ContributorAuthor More actions
@pkriete do you think we still have the other issue you mentioned (ReferenceError: Null is not defined)?
Judging by the path it's taking I'd say it was probably unrelated. So likely yes, but it's fairly rare and I've never been able to reproduce it in development.
I'm happy to call this issue resolved. Our biggest problem is gone - if I find a reproducible cause of the other one I'll open a new ticket. Thanks so much Stephen! stephenplusplus commented on May 26, 2017 Sounds good, thanks again for all of your help!
MetadataMetadataapi: pubsubIssues related to the Pub/Sub API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DevelopmentNo branches or pull requestsIssue actions
|