Open tegefaulkes opened 9 months ago
I've done some work addressing this, I just need to re-check if it's still an issue.
I just ran a manual test where I turned off wifi and unplugged the wired connection. I observed that
I did this twice without the node crashing. I'll do another quick test with switching networks.
When switching between the wifi to my mobile tethered hotspot I ended up crashing with the following.
❯ npm run polykey -- agent start -np ./tmp/test1
> polykey-cli@0.4.1 polykey
> ts-node src/polykey.ts agent start -np ./tmp/test1
✔ Please enter the password … ***
(node:3907665) [DEP0112] DeprecationWarning: Socket.prototype._handle is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
pid 3907665
nodeId voic41031s00o9rkq9tqekb58on1hfv9hvd31btegppml0pj1seg0
clientHost ::1
clientPort 33769
agentHost ::
agentPort 33496
(node:3907665) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. Use events.setMaxListeners() to increase limit
Error: send ENETUNREACH ::ffff:3.145.86.40:1314
Not exactly sure what's happening here. I'm guessing we're either using a bad IP address or possibly with the wifi turned off the network device starts returning ENETUNREACH
when trying to connect.
Also, switching between networks is very similar to a dropout, it's far from seamless. But to handle seamless network switching We'd likely have to implement the paths support in quiche.
What do you mean by paths support?
https://docs.rs/quiche/latest/quiche/struct.Connection.html#method.paths_iter
Quiche can make a connection to a peer with a single address, but in scenarios where we have multiple interfaces, or roaming between networks quiche switch between them seamlessly as separate paths.
Basically just allows the same connection to work with multiple network paths to the peer.
Another thing to note also, is that js-mdns does not currently handle adding or removal of network interfaces. Though it is not the cause of the above issue.
Describe the bug
I've found that whenever the network cuts out the node crashes. This is caused by the
js-quic
QUICSocket
throwing an error on send when the network is down. Since we're treating all socket errors as critical failures we're just allowing the error to bubble up.Ideally we handle this as a temp failure and not crash.
To Reproduce
Polykey
node.Expected behavior
I think everything should work as normal but connections and streams should timeout if the network is down for longer than it's timeout. So send failures due to network should be treated as a packet drop.
Platform (please complete the following information)