Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Maximum call stack exceeded in Select.js #5

Closed
vsukhomlinov opened this issue Jan 10, 2016 · 4 comments
Closed

Maximum call stack exceeded in Select.js #5

vsukhomlinov opened this issue Jan 10, 2016 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@vsukhomlinov
Copy link

Code in src/lib/interactive.js can crash with the "Maximum call stack exceeded" exception

Test:

test('Crash emulation', function(done) {
    var select = new MultiStream.Select()
    tcp.createServer(function (socket) {
      select.handle(socket)
    }).listen(8012)

    var socket = tcp.connect({port:8012}, function tcpConnectionOpen() {
      lpm.write(socket, PROTOCOLID+'\n')
      var i=0;
      while(i++<100000) {
        lpm.write(socket, 'ls\n')
      }
    })
  })
@vsukhomlinov
Copy link
Author

A ES6 generator is probably the best replacement for the current logic. Or at least that recursive call needs to be wrapped into process.nextTick().

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label Jan 11, 2016
@vsukhomlinov
Copy link
Author

@diasdavid Any plans to support native ES6 promises and eventually switch to promise-based logic? Or should I just patch the current logic using nextTick()?

@daviddias
Copy link
Member

We will be continuing use the callback pattern as the base, a promise API can be built on top, but breaking completely the current API is out of the table.

On using process.nextTick(), that is fine, as long as we don't browser compatibility (certainly there is a shim for that functionality somewhere)

@daviddias
Copy link
Member

No longer applies with the new version coming with #19 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants