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

Cannot connect to ipv6-only mongodb instance #57

Open
1977er opened this issue Jul 24, 2018 · 7 comments
Open

Cannot connect to ipv6-only mongodb instance #57

1977er opened this issue Jul 24, 2018 · 7 comments

Comments

@1977er
Copy link

1977er commented Jul 24, 2018

$ snap list wekan
Name   Version  Rev  Tracking  Developer  Notes
wekan  1.18     233  stable    xet7       devmode

on a Debian stretch with a nginx in front.

  • Built-in mongodb works fine.
  • External mongodb with with legacy IP address works fine.
  • The very same external mongodb with an ipv6 address gives the following error (resulting in an endless loop of starting/stopping the wekan instance)
Jul 24 06:25:10 web systemd[1]: Started Service for snap application wekan.wekan.
Jul 24 06:25:10 web /usr/bin/snap[23869]: cmd.go:105: DEBUG: restarting into "/snap/core/current/usr/bin/snap"
Jul 24 06:25:10 web wekan.wekan[23869]: MONGODB_BIND_UNIX_SOCKET=nill
Jul 24 06:25:10 web wekan.wekan[23869]: MONGODB_BIND_IP=ipv6only-mongodb.example.com
Jul 24 06:25:10 web wekan.wekan[23869]: MONGODB_PORT=27017
Jul 24 06:25:10 web wekan.wekan[23869]: MAIL_URL=smtp://user:[email protected]:25/ (default value)
Jul 24 06:25:10 web wekan.wekan[23869]: [email protected] (default value)
Jul 24 06:25:10 web wekan.wekan[23869]: ROOT_URL=http://wekan.example.com
Jul 24 06:25:10 web wekan.wekan[23869]: PORT=3001
Jul 24 06:25:10 web wekan.wekan[23869]: DISABLE_MONGODB=true
Jul 24 06:25:10 web wekan.wekan[23869]: CADDY_ENABLED=false (default value)
Jul 24 06:25:10 web wekan.wekan[23869]: CADDY_BIND_PORT=3001 (default value)
Jul 24 06:25:10 web wekan.wekan[23869]: MONGO_URL=mongodb://ipv6only-mongodb.example.com:27017/wekan
Jul 24 06:25:12 web wekan.wekan[23869]: /snap/wekan/233/programs/server/node_modules/fibers/future.js:313
Jul 24 06:25:12 web wekan.wekan[23869]: #011#011#011#011#011#011throw(ex);
Jul 24 06:25:12 web wekan.wekan[23869]: #011#011#011#011#011#011^
Jul 24 06:25:12 web wekan.wekan[23869]: MongoError: failed to connect to server [ipv6only-mongodb.example.com:27017] on first connect [MongoError: getaddrinfo ENOTFOUND ipv6only-mongodb.example.com ipv6only-mongodb.example.com:27017]
Jul 24 06:25:12 web wekan.wekan[23869]:     at Pool.<anonymous> (/snap/wekan/233/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:336:35)
Jul 24 06:25:12 web wekan.wekan[23869]:     at emitOne (events.js:116:13)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Pool.emit (events.js:211:7)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Connection.<anonymous> (/snap/wekan/233/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:280:12)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Object.onceWrapper (events.js:317:30)
Jul 24 06:25:12 web wekan.wekan[23869]:     at emitTwo (events.js:126:13)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Connection.emit (events.js:214:7)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Socket.<anonymous> (/snap/wekan/233/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:187:49)
Jul 24 06:25:12 web wekan.wekan[23869]:     at Object.onceWrapper (events.js:315:30)
Jul 24 06:25:12 web wekan.wekan[23869]:     at emitOne (events.js:116:13)
Jul 24 06:25:12 web systemd[1]: snap.wekan.wekan.service: Main process exited, code=exited, status=1/FAILURE
Jul 24 06:25:12 web systemd[1]: snap.wekan.wekan.service: Unit entered failed state.
Jul 24 06:25:12 web systemd[1]: snap.wekan.wekan.service: Failed with result 'exit-code'.
Jul 24 06:25:12 web systemd[1]: snap.wekan.wekan.service: Service hold-off time over, scheduling restart.
Jul 24 06:25:12 web systemd[1]: Stopped Service for snap application wekan.wekan.

ipv6only-mongodb.example.com resolves only to an AAAA record here.

@xet7
Copy link
Member

xet7 commented Jul 24, 2018

Maybe related:

meteor/meteor#7155 - just quessing, there could be some change needed for some Wekan options.

https://bugs.launchpad.net/snapstore/+bug/1710022

https://forum.snapcraft.io/t/api-snapcraft-io-ipv6-support/4531

@1977er
Copy link
Author

1977er commented Jul 24, 2018

meteor/meteor#7155 is about parsing a URL. I did not use raw IP addresses in my example but FQDNs. FQDNs are protocol family agnostic.

https://bugs.launchpad.net/snapstore/+bug/1710022
https://forum.snapcraft.io/t/api-snapcraft-io-ipv6-support/4531

You mean, if cannot install a software via IPv6, there is no need for that software to be IPv6 capable? ;-)

@xet7
Copy link
Member

xet7 commented Jul 25, 2018

This seems to be same issue as RocketChat/Rocket.Chat#8823 , both Wekan and Rocket.Chat are made with Meteor and MongoDB.

@xet7
Copy link
Member

xet7 commented Jul 25, 2018

Can you tell me what are those IPv6 only environments usually?

@xet7
Copy link
Member

xet7 commented Jul 25, 2018

I don't know is this mongo url syntax issue like at meteor/meteor#8066

@xet7
Copy link
Member

xet7 commented Jul 25, 2018

@1977er
Copy link
Author

1977er commented Jul 26, 2018

getaddrinfo ENOTFOUND suggests a name resolver issue. Using tcpdump I found out, that the DNS is only queried for an A record, but not for an AAAA record. Digging into mongodb-core/lib/connection/connection.js revealed that Connection needs an (address) family option to be set. That option defaults to legacy IP (4).

Unfortunately I don't know where the actual dns.lookup() is done. This function returns (among other things) the address family. This information needs to be fed to the Connection class.

Should easily be fixed. Maybe upstream since I don't know where mongodb-core belongs to.

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

2 participants