Skip to content

uncaughtException on TCP close #49

@boazshor

Description

@boazshor

I have a problem that accrues sporadically, I'm working on top of unstable servers (not my choice), that means that every once in a while all the connections get disconnected.
When that happens it looks like the driver doesn't reacts well:
stack:
[ 'TypeError: listener must be a function',
' at TypeError ()',
' at Connection.EventEmitter.removeListener (events.js:195:11)',
' at Query._removeAllListeners (/opt/Autonomy/shared/vertica-util/node_modules/vertica/lib/query.js:241:21)',
' at Query.onConnectionError (/opt/Autonomy/shared/vertica-util/node_modules/vertica/lib/query.js:130:10)',
' at Connection._onClose (/opt/Autonomy/shared/vertica-util/node_modules/vertica/lib/connection.js:364:23)',
' at Socket.g (events.js:180:16)',
' at Socket.EventEmitter.emit (events.js:95:17)',
' at TCP.close (net.js:465:12)' ] }

I looked at the code and it looks like a this problem:
you are trying to remove a listener:
this.connection.removeListener('EmptyQueryResponse', this.onEmptyQueryListener);

That we added in the run function:
Query.prototype.run = function() {
this.emit('start');
this.connection._writeMessage(new FrontendMessage.Query(this.sql));
this.connection.once('EmptyQueryResponse', this.onEmptyQueryListener = this.onEmptyQuery.bind(this));

which is declared on the Query:
Query.prototype.onEmptyQuery = function(msg) {
var err;
err = new errors.QueryError("The query was empty!");
if (this.callback) {
return this.error = err;
} else {
return this.emit('error', err);
}
};

Could it have something to do with the clients code?
Do you have a workaround?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions