Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

EINVAL error #804

Closed
yjh0502 opened this issue Mar 18, 2011 · 15 comments
Closed

EINVAL error #804

yjh0502 opened this issue Mar 18, 2011 · 15 comments
Labels

Comments

@yjh0502
Copy link

yjh0502 commented Mar 18, 2011

I'm now building nodejs socket server, and this error kills my server.

node.js:116
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: EINVAL, Invalid argument
    at doConnect (net.js:530:19)
    at net.js:696:9
    at dns.js:175:34
    at IOWatcher.callback (dns.js:53:15)

I also added 'error' handler to my server, but it doesn't works for me.

@tj
Copy link

tj commented Mar 18, 2011

ubuntu? (curious)

@yjh0502
Copy link
Author

yjh0502 commented Mar 18, 2011

Yes. Ubuntu 10.10.
On Mar 19, 2011 12:28 AM, "visionmedia" <
reply@reply.github.com>
wrote:

ubuntu? (curious)

Reply to this email directly or view it on GitHub:
#804 (comment)

@tj
Copy link

tj commented Mar 18, 2011

interesting... people keep having this with issue with cluster on Ubuntu, perhaps it really is not cluster's fault, I still haven't had time to look. Can you post a gist of your code? or at least enough to reproduce this error

@yjh0502
Copy link
Author

yjh0502 commented Mar 19, 2011

var tls = require('tls'),
    fs = require('fs'),
    crypto = require('crypto');

var options = {
    key: fs.readFileSync('cert/key.pem'),
    cert: fs.readFileSync('cert/cert.pem')
};

var server = tls.createServer(options, function(s) {
});

server.on('error', function(e) {
    console.log('server down suddenly: ' + e);
    server.close();
    server.listen(port);
});

server.listen(10000);

@yjh0502 yjh0502 closed this as completed Mar 19, 2011
@bkw
Copy link

bkw commented Mar 20, 2011

closed by accident? Please reopen. Also see LearnBoost/cluster#47

@nergal
Copy link

nergal commented Apr 21, 2011

same problem on:
Linux dev.omg.local 2.6.18-164.15.1.el5.028stab068.9 #1 SMP Tue Mar 30 18:07:38 MSD 2010 x86_64 x86_64 x86_64 GNU/Linux

node v0.4.6, no any server features used

@yjh0502 yjh0502 reopened this Apr 21, 2011
@curtisc
Copy link

curtisc commented Apr 26, 2011

I'm seeing the same issue intermittently on 0.4.6 on Ubuntu 10.04.2. I haven't found the exact conditions that cause it, I just see it in my logs occasionally. I'm not using cluster, so I don't think it's a cluster issue. Will post if I can catch exactly why it happens

@demian85
Copy link

Similar problem here

net.js:730
          bind(self.fd, 0, local);
          ^
Error: EINVAL, Invalid argument
    at net.js:730:11
    at dns.js:196:34
    at IOWatcher.callback (dns.js:74:15)

Node 0.4.9 / Debian

@bnoordhuis
Copy link
Member

Can anyone confirm / deny this happening on master?

Note to self: possibly a race between listen() and accept().

@yjh0502
Copy link
Author

yjh0502 commented Jul 21, 2011

Just a workaround, but sometimes (not always) sudden death of a process can be prevent by adding 'error' handler before opening socket. If there is no error handler, nodejs process dies without recover, but if a error handler is attached, the error is caught by handler and could be handled safely. It could be applied to not only a socket connection, but all kinds of network-related functions like TLS or HTTP.

@Somebi
Copy link

Somebi commented Aug 12, 2011

Same error here on Virtual Machine Ubuntu OS while crawling websites

@trevnorris
Copy link

I haven't been able to reproduce this issue on v0.8.15.

@bnoordhuis
Copy link
Member

I can't find the commit but this was fixed late in v0.4's life cycle. Closing.

@vikrama
Copy link

vikrama commented Oct 10, 2013

net.js:157
    this._handle.open(options.fd);
                 ^
Error: EINVAL, invalid argument

v0.10.20 on cygwin

@trevnorris
Copy link

@vikrama Have a reproducible test case? Also, I don't think we officially support cygwin anymore now that Node has native Windows support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants