Repository navigation
Bigtable this.end() does not stop the stream? #6
Description
Activity
From @stephenplusplus on May 2, 2017 16:4
I recall seeing this discussed in another issue, and it might be an issue with one of our dependencies. I will look into it. Thanks for reporting.
- addedtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
on Oct 31, 2017 From @stephenplusplus on May 2, 2017 17:17
The issue I was thinking of doesn't actually relate to the Bigtable API, so throw that theory out the window.
I tried to reproduce, but couldn't. My script and results:
var bigtable = require('@google-cloud/bigtable')() bigtable.getInstancesStream() .on('data', function (instance) { console.log('instance') this.end() }) .on('end', function () { console.log('over') }) // output: instance over
Without the
this.end():var bigtable = require('@google-cloud/bigtable')() bigtable.getInstancesStream() .on('data', function (instance) { console.log('instance') }) .on('end', function () { console.log('over') }) // output: instance instance instance over
Are you using a different method? Could there be other code interfering with when
this.end()is called? Seeing your code might help.From @arbesfeld on May 3, 2017 18:17
We're using
table.createReadStream(). Here's what it looks like:await new Promise((resolve, reject) => { table .createReadStream({ decode: true, start: 'foo', end: 'bar' filter: [{ column: { cellLimit: 1, }, }], }) .on('data', function onData(row) { this.end(); resolve(); }) .on('end', resolve) .on('error', reject); });
Other methods could be using
tableat the same time, if that affects something?From @stephenplusplus on May 3, 2017 18:19
Would it be a problem that
resolve()is called from thedatahandler andend?this.end()will gracefully exit the stream, which means that the end event will be called.From @arbesfeld on May 3, 2017 20:4
That would be acceptable for our application. We found that
onDatawould continued to be called even afterthis.end(). We're on Node 7.9.0, and we found a workaround by introducing another variable outside of the promise.From @stephenplusplus on May 3, 2017 20:9
Found the issue. PR incoming.
From @stephenplusplus on May 4, 2017 18:54
PR sent: #2276
- addedpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.and removed
on Oct 31, 2017 - added a commit that references this issue
on Dec 11, 2017 - added a commit that references this issue
on Dec 13, 2017 - ghost removedpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.
on Dec 13, 2017 - addedapi: bigtableIssues related to the googleapis/nodejs-bigtable API.Issues related to the googleapis/nodejs-bigtable API.
on Jan 31, 2020 - added🚨This issue needs some love.This issue needs some love.triage meI really want to be triaged.I really want to be triaged.
on Apr 6, 2020
From @arbesfeld on May 2, 2017 14:15
Using Bigtable 0.9.1 - I seem to be getting more than 1 result after calling
this.end(). Is this expected behavior?Copied from original issue: googleapis/google-cloud-node#2271