Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EINVAL during syscall=connect #13431

Closed
pdkovacs opened this issue Jun 3, 2017 · 7 comments · May be fixed by XirdigH/node-22#60, baby636/node#22, Dmarch28/node#37, baby636/node#23 or baby636/node#24
Closed

EINVAL during syscall=connect #13431

pdkovacs opened this issue Jun 3, 2017 · 7 comments · May be fixed by XirdigH/node-22#60, baby636/node#22, Dmarch28/node#37, baby636/node#23 or baby636/node#24
Labels
net Issues and PRs related to the net subsystem.

Comments

@pdkovacs
Copy link

pdkovacs commented Jun 3, 2017

  • Version: v6.10.3
  • Platform: Linux pici 4.9.27-v7+ #997 SMP Tue May 9 19:58:37 BST 2017 armv7l armv7l armv7l GNU/Linux
  • Subsystem: net (?)

I am getting the following error when trying to access a host via HTTP:

2017-05-28T07:20:04.765Z - error:  Error: connect EINVAL 108.160.151.39:443
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
2017-05-28T07:20:04.781Z - error: stopping... code=EINVAL, errno=EINVAL, syscall=connect, address=108.160.151.39, port=443
@addaleax addaleax added the net Issues and PRs related to the net subsystem. label Jun 3, 2017
@addaleax
Copy link
Member

addaleax commented Jun 3, 2017

Can you make sure that you can connect to the same host and port combination using other tools, e.g. nc? If so, can you try to attach strace to node and share the output?

@gireeshpunathil
Copy link
Member

I guess the end-point is an HTTPS one - assumption based on the port number.

@bnoordhuis
Copy link
Member

Can you post your code? Are you using the localAddress or localPort options?

@pdkovacs
Copy link
Author

pdkovacs commented Jun 3, 2017

Can you make sure that you can connect to the same host and port combination using other tools, e.g. nc

I got this error after the same code executed successfully hundreds of thousands of times. (Sure I can connect with other tools.)

I probably should have mentioned in the problem description that this is a sporadic error. In fact this is the first time I saw this error after the same code executed about half a million times without error. (I earlier observed two other errors as well (once each): EAI_AGAIN and ENOTFOUND. But these are "operational" errors, whereas EINVAL smells a software bug.)

Can you post your code?

https://github.com/pdkovacs/noip-updater/blob/master/src/backend/MyPublicIpChecker.ts#L33
The request options used in this case were:

        {
            protocol: 'https:',
            host: 'whatismypublicip.com',
            method: 'GET'
        }

Are you using the localAddress or localPort options?

Probably not (not explicitly at least). See above.

@pdkovacs
Copy link
Author

pdkovacs commented Jun 3, 2017

If so, can you try to attach strace to node and share the output?

I will, if the error re-occurs at least once more. ;-)

@gireeshpunathil
Copy link
Member

closing due to inactivity, please re-open with requested data, if still outstanding

@oxygen
Copy link

oxygen commented Oct 4, 2018

I'm getting this using Linux Subsystem for Windows (WSL).

After many https:// outgoing requests, and only when doing hundreds or thousands of them in a short period (but not concurrently, and even with artificially added 100ms pause between requests), the above starts to happen, exactly as described by the author of the bug.

The connectivity is cut down both ways (the listening server is also cut off from listening along with all existing connections; which has nothing to do with the client functionality, which is also cut off).

Other apps running alongside (some Linux native ones and another NodeJS app) are unaffected, but cannot talk to this one that is showing the above behaviour.

If you are not familiar with WSL, it is worth mentioning it does not have the Linux kernel, but an ABI compatible layer, so it could be that NodeJS is not at fault. Just leaving this here, maybe it will help rule out the OS as a culprit after more evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment