nym icon indicating copy to clipboard operation
nym copied to clipboard

[Issue] Packets are lost using the native client

Open corentin-junod opened this issue 2 years ago • 2 comments

Description While testing to send messages over the network using the native client, some messages never came back.

Detailed Description The python script linked below connects to the client using websockets, and send messages to itself, keeping track of the received messages. If a message takes more than 100s to come back, the python script times out, and sends the next message. By logging the behaviour of the Nym client, I can see that every message is received by the Nym client and then correctly split into multiple packets. Each packet is assigned a route through the network, as expected. By having the script run for some time, I noticed that a very small proportion of the messages (around 0.003%) are timing out, and are never logged as received by the python script, even multiple hours later. This problem doesn't seem to be correlated with particular mixnodes, as all the lost packets had completely different routes. This behaviour was observed with multiple different gateways. I haven't kept track of the packets after their route is selected. I'm not sure that the packets were truly sent by the Nym client or not.

Expected behaviour The network should never silently drop messages

Steps to Reproduce

  • Given I was running the script linked below
  • When I looked at the received packets
  • I expected all the packets sent to be logged as received
  • But in rare cases, I noticed some packets have timed out and were never received

Which area of Nym were you using?

  • Application: Nym native client, using websockets
  • OS: Ubuntu 22.04.2 LTS
  • Version: Nym client 1.1.10

textsend.zip

corentin-junod avatar Mar 20 '23 13:03 corentin-junod

@Dolpic have you considered sending Ping/Pong messages to keep the websocket alive? See https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2

mmsinclair avatar Jul 17 '23 11:07 mmsinclair

Following this description, this is already handled by the WebSocket implementation in Python : https://websockets.readthedocs.io/en/latest/topics/timeouts.html#keepalive-in-websockets And also, when this occurs, only one packet times out and the following packets are fine.

corentin-junod avatar Jul 18 '23 08:07 corentin-junod