Skip to content
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

Bigtable error silently ignored #2724

Closed
kolodny opened this issue Nov 5, 2017 · 11 comments
Closed

Bigtable error silently ignored #2724

kolodny opened this issue Nov 5, 2017 · 11 comments
Assignees
Labels
core type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@kolodny
Copy link
Contributor

kolodny commented Nov 5, 2017

  • OS: OSX 10.12.6
  • Node.js version: 8.5.0 and 6.x
  • npm version: 5.3.0
  • google-cloud-node version: bigtable@0.10.2 common-grpc@0.4.2 retry-request@3.1.0

Steps to reproduce

const bigtable = require('@google-cloud/bigtable');

const bigtableClient = bigtable();
const instance = bigtableClient.instance(process.env.INSTANCE_ID);
const table = instance.table('doesnotexist');

Promise.resolve()
  .then(() => table.getRows())
  .then(([rows]) => console.log(`Read ${rows.length}`))
  .catch(error => console.error(`caught ${error}`))

I chased this bug down to https://github.com/GoogleCloudPlatform/google-cloud-node/blob/a64ad81517045196cf5a3f468ea15aad1e2c25da/packages/common-grpc/src/service.js#L376-L385

This "fake" response call causes streamResponseHandled in retry-request to be set to true on the fake response, that has the consequence of never firing the error callback. https://github.com/stephenplusplus/retry-request/blob/4181eec8187c3603d4e4e68db1ee6ac27725afa3/index.js#L113-L133

I tried reverting the code in #1444 to see if I could replicate the bug referenced at #1443 to see if I could find a different solution that would avoid this nasty regression, but I wasn't able to repro (I always got a response). I suspect that the code can be safely reverted. Reverting that bit of code did fix the bug of silently ignoring erorrs!

Thanks!

@stephenplusplus stephenplusplus added api: bigtable Issues related to the Bigtable API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 5, 2017
@stephenplusplus
Copy link
Contributor

This issue was moved to googleapis/nodejs-bigtable#8

@kolodny
Copy link
Contributor Author

kolodny commented Nov 5, 2017

I suspect the underlying bug lives in google-cloud-node and was just manifesting this way in Bigtable. Either way awesome response time

@stephenplusplus
Copy link
Contributor

Woops, that's a good point. Well, we'll see what @callmehiphop thinks and maybe having two issues will make us fix it twice as fast :)

@callmehiphop callmehiphop reopened this Nov 5, 2017
@callmehiphop
Copy link
Contributor

@kolodny is correct, this is definitely a core issue.

@stephenplusplus I think this might actually be a retry-request issue. It seems that after a response event is received retry-request will swallow any errors produced by the stream moving forward. IMO the fix here would be to something like

requestStream.on('error', err => retryStream.emit('error', err));

Around https://github.com/stephenplusplus/retry-request/blob/master/index.js#L176

@stephenplusplus
Copy link
Contributor

@stephenplusplus
Copy link
Contributor

Ah, I see what you're saying. At the point you linked, we know the steam is good to go, so forwarding errors then is what we should do.

@callmehiphop
Copy link
Contributor

I understand, my suggestion is if the response comes through first then you re-emit any request errors on the stream returned to the user. Regardless of whether or not this is a grpc implementation issue, I find it strange that retry-request would swallow an errors that occur mid-stream.

stephenplusplus referenced this issue in googleapis/retry-request Nov 6, 2017
@stephenplusplus
Copy link
Contributor

I released a new retry-request that will forward errors from the request stream.

@callmehiphop will that fix this issue, or is there more to do from common-grpc?

@stephenplusplus stephenplusplus added core and removed api: bigtable Issues related to the Bigtable API. labels Nov 6, 2017
@callmehiphop
Copy link
Contributor

I'm pretty sure that fix should resolve this issue!

@stephenplusplus
Copy link
Contributor

@kolodny please remove your local node_modules, reinstall, and let us know how it goes!

@kolodny
Copy link
Contributor Author

kolodny commented Nov 6, 2017

Confirmed, the issue now appears fixed. Thanks!

@kolodny kolodny closed this as completed Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants