Skip to content

PROTOCOL_CONNECTION_LOST during streaming query #566

Closed
@cheyner

Description

@cheyner

I'm using version 2.0.0-alpha8 and node v0.10.11 and am experiencing an issue where I'm getting a lost connection error while streaming the results of a query.

I realize there are a number of issues relating to lost connections. And I've seen solutions like connection.ping() to avoid an idle connection timeout, or connection.on('error') handlers to re-establish a severed connection. Because my problem happens while a query is running, this seems like a different scenario than others have reported.

I am creating a fileWriteStream and piping the results of the SQL query into that writestream. I also have a CsvPrepStream in the pipeline which transforms the data object into a string of text suitable for a CSV.

This process runs just fine with ~200k or fewer results in the sql query. Bigger query results, however, cause the PROTOCOL_CONNECTION_LOST error after a minute or so.

I realize this doesn't give the full context of what's going on, but should give an idea:

var query = me.connection.query({
    sql: me.query,
    nestTables: true
})
    .stream({
        highWaterMark: 20
    })
    .pipe(new CsvPrepStream(
        {objectMode: true},
        me.fields
    ))
    .pipe(me.fileStream);

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions