Comments (6)
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.
Removing the recursion should have fixed this. Let me know if you still have errors.
from haibu-carapace.
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.
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.
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.
@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)
- make a loader able to carapace itself HOT 1
- [v0.6] `net` module wrapper fails to override `_doListen` correctly HOT 6
- [v0.6] Remove hook.io in favor of require('child_process').fork HOT 1
- `net` module wrapper doesn't override host argument? HOT 2
- detecting ports the easy way HOT 5
- Abstract plugin loading into `carapace.load()` HOT 2
- Add homepage/repo to package.json HOT 1
- Examples not working as expected HOT 2
- Catch `uncaughtException` and send it to haibu over IPC
- Problem installing HOT 6
- Guide for creating new Plugins?
- C++ modules that use C sockets don't work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haibu-carapace.