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

eventObject timeout has a timeout set when it's not expecting a response #152

Open
gak10100 opened this issue Oct 23, 2023 · 0 comments
Open

Comments

@gak10100
Copy link

gak10100 commented Oct 23, 2023

Inside the _processOutboundEvent event Objects are created and a timeout is set. The problem is that a timeout is set for event objects that aren't expecting a response.

eventNode.data = eventObject;
let ackTimeout = options.ackTimeout == null ? this.ackTimeout : options.ackTimeout;
eventObject.timeout = setTimeout(() => {
this._handleEventAckTimeout(eventObject, eventNode);
}, ackTimeout);
this._outboundBuffer.append(eventNode);

Inside the _flushOutboundBuffer function Event Objects are passed off to the transport object

AGClientSocket.prototype._flushOutboundBuffer = function () {
let currentNode = this._outboundBuffer.head;
let nextNode;
while (currentNode) {
nextNode = currentNode.next;
let eventObject = currentNode.data;
currentNode.detach();
this.transport.transmitObject(eventObject);
currentNode = nextNode;
}
};

but because the event object doesn't have a callback it doesn't add it to the callbackMap

https://github.com/SocketCluster/socketcluster-client/blob/f5514434f51369166de9e5dafba2f7da147fb93e/lib/transport.js#L373C10-L387

This can lead to the timeout to hang even after the client has disconnected.

@gak10100 gak10100 changed the title eventObject timeout not cleaned up in _flushOutboundBuffer eventObject timeout has a timeout set when it's not expecting a response Oct 23, 2023
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

1 participant