catch Exceptions in pubsub
stephenplusplus opened this issue · 6 comments
From @mytholog on August 3, 2016 8:37
Environment details
- OS: Mac (Capitan)
- Node.js version: 4.4.7
- gcloud-node version: 0.37.0
Steps to reproduce
- require
gcloud-node
- run code from https://github.com/GoogleCloudPlatform/nodejs-getting-started/tree/master/6-pubsub
"stack":[
"Error: Deadline Exceeded",
" at Function.GrpcService.decorateError_ (/node_modules/gcloud/lib/common/grpc-service.js:482:34)",
" at Object.callback (/node_modules/gcloud/lib/common/grpc-service.js:247:35)",
" at /node_modules/gcloud/node_modules/grpc/src/node/src/client.js:420:14"
],
"level":"error",
"message":"uncaughtException: Deadline Exceeded"
Copied from original issue: googleapis/google-cloud-node#1465
To what degree should we be catching exceptions?
Personally, I'd err on the side of not catching them unless they are not exceptional. If the sample halts and catches fire due to a truly exceptional (i.e. problematic) event, perhaps we could display a slightly better message to the user (along the lines of "Oh no, something went wrong!") - but we'd still have to give them the stack trace/exception type so they/we can debug it.
@jmdobry thoughts?
Is this reproducible with the latest @google-cloud/pubsub
?
@jmdobry Not from what I've seen on my machine (everything works fine) - that being said, this seems like a nondeterministic error.
@stephenplusplus @mytholog Can you clarify whether the intent of this issue was:
- We should fix this particular error
- We should catch errors within the getting started samples (what I thought your point was initially)
- Something else entirely
Deferring to @mytholog.
"@google-cloud/pubsub": "^0.3.0"
reproduced on the third or more launch
{
"message": "Deadline Exceeded",
"stack": "Error: Deadline Exceeded\n at /tmp/cl/node_modules/grpc/src/node/src/client.js:417:17",
"code": 504,
"metadata": {
"_internal_repr": {}
},
"level": "error"
}
{
"date": "Sat Oct 15 2016 10:19:56 GMT+0700 (+07)",
"process": {
"pid": 28741,
"uid": 501,
"gid": 20,
"cwd": "/tmp/cl",
"execPath": "/usr/local/Cellar/node/6.8.0/bin/node",
"version": "v6.8.0",
"argv": [
"/usr/local/Cellar/node/6.8.0/bin/node",
"/tmp/cl/worker.js"
],
"memoryUsage": {
"rss": 84951040,
"heapTotal": 70103040,
"heapUsed": 46127008
}
},
"os": {
"loadavg": [
2.34619140625,
1.7861328125,
1.578125
],
"uptime": 180497
},
"trace": [
{
"column": 17,
"file": "/tmp/cl/node_modules/grpc/src/node/src/client.js",
"function": null,
"line": 417,
"method": null,
"native": false
}
],
"stack": [
"Error: Deadline Exceeded",
" at /tmp/cl/node_modules/grpc/src/node/src/client.js:417:17"
],
"level": "error",
"message": "uncaughtException: Deadline Exceeded"
}
{
"error": {
"code": 504,
"metadata": {
"_internal_repr": {}
}
},
"currentJobMessage": null,
"level": "error",
"message": "uncaughtException in worker"
}
@mytholog Which region does your project use? If you're using a region that is geographically far away from you, that may contribute to timeout issues. (e.g. europe-west1
may be better for someone in Russia than a us
-based region.)
Also, I'm assuming your issue revolves around this error specifically. If your argument is that exception handling needs to be improved, please let us know so we can steer things in that direction.