Skip to content

Connection problems when using node-imap against a dual-stack server from a single-stack client. #918

Description

@Rudd-O

As seen in node-red/node-red-nodes#1065 , attempting to connect to a server that has IPv4 and IPv6 addresses from a client that has an IPv6 stack but doesn't have a globally-scoped IPv6 address causes issues:

May 08 00:26:34 assistant Node-RED[3831665]: Error checking: AggregateError
May 08 00:26:34 assistant Node-RED[3831665]: Stack: AggregateError
May 08 00:26:34 assistant Node-RED[3831665]:     at internalConnectMultiple (node:net:1114:18)
May 08 00:26:34 assistant Node-RED[3831665]:     at internalConnectMultiple (node:net:1177:5)
May 08 00:26:34 assistant Node-RED[3831665]:     at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
May 08 00:26:34 assistant Node-RED[3831665]:     at listOnTimeout (node:internal/timers:575:11)
May 08 00:26:34 assistant Node-RED[3831665]:     at process.processTimers (node:internal/timers:514:7)
May 08 00:26:34 assistant Node-RED[3831665]: Errors: Error: connect ETIMEDOUT <IPv4>:993,Error: connect ENETUNREACH <IPv6>:993 - Local (:::0)

(The library's IMAP object is being instantiated here.)

Something in the library appears to try to connect in parallel to both IPv6 and IPv4 addresses (using the healthy 15 second timeout given to it by the caller), and yet immediately the library calls its on.error handler with an aggregate error, signaling a timeout for the server's IPv4 address and a (100% reasonable) ENETUNREACH for the server's IPv6 address.

Please either fix handling of IPv6 (a good fix would be to ensure if either of the two connection modes works, ignore the other error) or provide an option to force only IPv4 or IPv6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions