Only add defined callbacks to the stack#447
Merged
Merged
Conversation
Before that commit, undefined callbacks were also added to the array, which could lead to 'Maximum call stack size exceeded' error when flush() method was called. Fixes socketio#399
Contributor
|
Looks to me that you're fixing symptoms here instead of the actual bug, you probably want to prevent |
Member
Author
|
@3rd-Eden my reasoning is that when using Socket.prototype.send =
Socket.prototype.write = function (data, options, callback) {
this.sendPacket('message', data, options, callback);
return this;
}; |
Member
Author
|
@3rd-Eden or have I misunderstood your comment? |
Member
Author
|
Steps to reproduce: var opts = { allowUpgrades: false, transports: ['websocket'] };
var engine = listen(opts, function (port) {
var socket = new eioc.Socket('ws://localhost:%d'.s(port), { transports: ['websocket'] });
engine.on('connection', function (conn) {
for (var i = 0; i < 200000; i++) {
conn.send('a');
}
});
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The kind of change this PR does introduce
Current behaviour
Before that commit, undefined callbacks were also added to the array,
which could lead to 'Maximum call stack size exceeded' error when
flush() method was called.
New behaviour
Other information (e.g. related issues)
Fixes #399
Fixes socketio/socket.io#2589