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

Linode VM and Nodejs preferred IPV6? #292

Open
trames57 opened this issue Jan 29, 2022 · 0 comments
Open

Linode VM and Nodejs preferred IPV6? #292

trames57 opened this issue Jan 29, 2022 · 0 comments

Comments

@trames57
Copy link

Linux distribution: Arch Linux

On my Linode VM, I upgraded from Node 16 to Node 17.3. After this, I could no longer connect via nano to my couchdb. It seems that in my VM, the port 5984 is redirected to another open port e.g 127.0.0.1:5984 -> 127.0.0.1:xxxxx. However, it does not create a redirect for ::1:5984 so I was getting a connection refused.

I found this by doing a console.log(response) in ../node_modules/nano/lib/nano.js just above line 137 (a socket error)

Error: connect ECONNREFUSED ::1:5984
3 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
4 errno: -111,
5 code: 'ECONNREFUSED',
6 syscall: 'connect',
7 address: '::1',
8 port: 5984,
9 config: {
10 url: 'http://localhost:5984/musiccat/_find',
11 method: 'post',
12 data: '{"selector":{"$or":[{"dtype":"album"},{"dtype":"code","code_type":"format"}]},"fields":["_id","dtype","code_type","name","images","format","_attachments"],"use_index":"dtype-name-index","limit":999999}',
13 headers: {
14 Accept: 'application/json',
15 'Content-Type': 'application/json',
16 'user-agent': 'nano/9.0.5 (Node.js v17.3.0)',
17 'Accept-Encoding': 'deflate, gzip',
18 'Content-Length': 201
19 },...

On my LInode VM, I disabled IPV6 for all interfaces (in /etc/sysctl.d/40-ipv6.conf). After doing that, the redirects are gone and the connection starting working again. It took many hours to find this problem. Today I had found an entry on Reddit where new versions of Nodejs are now preferring IPV6. However, when I look at Nodejs net.socketAddress, the default family is still 'ipv4'.

I am not sure how to configure the nano connection to only use IPV4 or if something needs to change in the nano library to help with this issue so people don't have to completely disable IPV6 on their systems.

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

No branches or pull requests

1 participant