Skip to content

Cancelling a read row stream doesn't cancel the underlying grpc stream #506

@igorbernstein2

Description

@igorbernstein2

This is copied from a stackoverflow question:

https://stackoverflow.com/questions/56918799/how-to-manually-end-stream-created-by-tablecreatereadstream

I want to process data from BigTable table in a stream, but end stream early. I am using this code for Node.js (slightly modified https://github.com/googleapis/nodejs-bigtable/blob/master/samples/document-snippets/table.js#L215):

const stream = new BigTable({projectId, keyFilename})
  .instance(instanceId)
  .table(tableName)
  .createReadStream();
stream.on('data', () => {
  stream.end();
});
stream.on('end', () => {
  console.log('end');
  stream.destroy();
});
stream.on('close', () => {
  console.log('close');
});

Output is:

end
close

But the process is not yet finished. So, i believe that some resources are not closed. How should i stop stream and close relevant resources?

Metadata

Metadata

Labels

api: bigtableIssues related to the googleapis/nodejs-bigtable API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions