Code Monkey home page Code Monkey logo

Comments (6)

stolsma avatar stolsma commented on June 2, 2024

BTW the actual and desired in the carapace::port event is always giving the same port number (the new port number not the requested one). i.e. desired and port are always the same, even when _doListen sees the desired port in use and finds a higher free one.

from haibu-carapace.

bmeck avatar bmeck commented on June 2, 2024

Removing the recursion should have fixed this. Let me know if you still have errors.

from haibu-carapace.

stolsma avatar stolsma commented on June 2, 2024

Nope it still crashes at:

Error: EADDRINUSE, Address already in use
    at Array.<anonymous> (/home/sander/Development/apiary/node_modules/haibu-carapace/lib/net.js:108:7)
    at EventEmitter._tickCallback (node.js:126:26)

I added a check for EADDRINUSE in the try... catch (line 131) and that solves it. It looks like:

     catch (err) {
        if (err.code === 'EADDRINUSE') {
            self._doListen(desired + 1, ip);
        }
        else {
            self.close();
            self.emit('error', err);
        }
        return
    }

See https://gist.github.com/1142394 for the total code I debugged together. I don't use your for loop!! Thats why I didn't want to make a pull of it... (the other reason for not making a pull is that I don't fully understand the why and what of the old code and I don't want to break things...)

from haibu-carapace.

bmeck avatar bmeck commented on June 2, 2024

Ah I see. An ugly but working fix is to wrap in another call, recursion with a new port will mess w/ actual and desired when the events are emitted. Just use the original desired port, eventual consistency will take place.

from haibu-carapace.

stolsma avatar stolsma commented on June 2, 2024

Your fix solved it almost only I got now:

Error: EINVAL, Invalid argument
    at Server._doListen (/home/sander/Development/apiary/node_modules/haibu-carapace/lib/net.js:73:15)
    at Array.<anonymous> (/home/sander/Development/apiary/node_modules/haibu-carapace/lib/net.js:137:14)
    at EventEmitter._tickCallback (node.js:126:26)

Putting in a self.fd = socket(self.type); line solved that.

In my pull request I also solved the event data (correct desired and port property data).

from haibu-carapace.

stolsma avatar stolsma commented on June 2, 2024

@bmeck and @indexzero

Ok, I created a test program for this issue. The repo is here: [email protected]:stolsma/haibu-carapace-test.git

Running with node test.js will create most of the times the following error:

Error: EADDRINUSE, Address already in use
    at Array.<anonymous> (/home/sander/Development/carapacetest/node_modules/haibu-carapace/lib/net.js:104:7)
    at EventEmitter._tickCallback (node.js:126:26)

Sometimes also the following error is raised but I think thats related to the crash of the connected child:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: ECONNRESET, Connection reset by peer
    at Socket._writeImpl (net.js:159:14)
    at Socket._writeOut (net.js:450:25)
    at Socket.write (net.js:377:17)
    at EventEmitter.<anonymous> (/home/sander/Development/carapacetest/node_modules/hook.io/node_modules/dnode/index.js:234:20)
    at EventEmitter.emit (events.js:64:17)
    at EventEmitter.request (/home/sander/Development/carapacetest/node_modules/hook.io/node_modules/dnode/node_modules/dnode-protocol/index.js:51:14)
    at Object.message (/home/sander/Development/carapacetest/node_modules/hook.io/node_modules/dnode/node_modules/dnode-protocol/index.js:80:26)
    at [object Object].<anonymous> (/home/sander/Development/carapacetest/node_modules/hook.io/lib/hookio/hook.js:235:16)
    at [object Object].<anonymous> (/home/sander/Development/carapacetest/node_modules/hook.io/node_modules/eventemitter2/lib/eventemitter2.js:185:22)
    at [object Object].emit (/home/sander/Development/carapacetest/node_modules/hook.io/lib/hookio/hook.js:119:38)

Hope this is enough to crate the same errors at your computers...

from haibu-carapace.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.