AsyncSocket seems to be dropping data

2020-07-20 Thread snej
UPDATE: The bug has been [fixed in devel](https://github.com/nim-lang/Nim/pull/15012) thanks to @dom96. Turned out to be a mistake with not handling EAGAIN properly. I am much relieved.

AsyncSocket seems to be dropping data

2020-07-16 Thread spip
Same assertion error on Linux. ... RCVD #269: 000269 This is message #269 of ∞. Please stay tuned for more. 000269 This is me... RCVD #270: 000270 This is message #270 of ∞. Please stay tuned for more. 000270 This is me... RCVD #715: 000715 This is message #715 of ∞.

AsyncSocket seems to be dropping data

2020-07-16 Thread detla
In case you haven't got feedback from Linux users, this is running the gh test case under Linux (Debian bullseye, kernel 5.7: [...] SENT #18336 SENT #18337 SENT #18338 SENT #18339 SENT #18340 RCVD #647: 000647 This is message #647 of ∞. Please stay tuned for

AsyncSocket seems to be dropping data

2020-07-16 Thread snej
Filed [https://github.com/nim-lang/Nim/issues/15003](https://github.com/nim-lang/Nim/issues/15003) Would appreciate it if anyone could run the test case (there's a newer version attached to the Github issue) on non-Mac systems and see if it reproduces. The bug may well be specific to kqueues in

AsyncSocket seems to be dropping data

2020-07-16 Thread snej
Here's the plain AsyncSocket version. The message counts are different but the failure is the same. import asyncdispatch, asyncnet, strformat, sugar const FrameSize = 999 proc runServer() {.async.} = # Server side: var server = newAsyncSocket()

AsyncSocket seems to be dropping data

2020-07-16 Thread snej
OK, here's a reproducible test case (still using news). It opens a loopback socket; the client side sends out messages as fast as possible, and the server reads the messages slowly, to create some backpressure. The client watches the order that the send futures complete, to make sure they're con

AsyncSocket seems to be dropping data

2020-07-16 Thread snej
I wasn't sure which WebSocket module to use ... news seems like the newest, since it's based on treeform/ws which is based on niv/websocket ¯_(ツ)_/¯ All three libraries are pretty immature, I don't see how this can be news's fault, since if you look at [the send() function](https://github.com/T

AsyncSocket seems to be dropping data

2020-07-16 Thread dom96
Wow, we now have 3 different websocket implementations. Nice :) I must say I am suspicious of `news` here, if I were you I would do the following: * Check whether the same behaviour happens with Chronos (since `news` apparently supports it as well) * Reproduce this problem with an `AsyncSoc

AsyncSocket seems to be dropping data

2020-07-15 Thread snej
**tl;dr:** I'm issuing lots of small writes to an AsyncSocket, and some of the writes are being dropped — they don't show up on the other end of the TCP connection, and their corresponding `send` Futures never complete. I'm using the `news` package to send lots of small WebSocket messages (on th