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

uncaughtException on TCP close #49

Open
boazshor opened this issue Sep 17, 2015 · 1 comment
Open

uncaughtException on TCP close #49

boazshor opened this issue Sep 17, 2015 · 1 comment

Comments

@boazshor
Copy link

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.

@wvanbergen
Copy link
Owner

Yeah, this probably is an error handling problem in the client somewhere.

The solution would be to only unregister the listeners if they are set only. I don't have a working node.js or vertica setup available right now, so it's unlikely I will fix this myself any time soon. I will gladly accept patches for this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants