quinn icon indicating copy to clipboard operation
quinn copied to clipboard

Sending/receiving of a >~100KB of data fails on some Android devices

Open inetic opened this issue 5 months ago • 28 comments

On a particular Samsung Android phone sending and receiving of ~100KB data fails with ConnectionLost(TimedOut).

We wrote a test for it here send_receive.rs (also attaching for posterity send_receive.rs.txt).

The test creates a connected pair of sockets, sender and a receiver. The sender sends 100 messages of size 1000B to the receiver (the exact number of messages and sizes doesn't seem to matter as long as it's above some threshold).

Everywhere apart of that Samsung phone the test runs as expected and the receiver receives all the messages. On the Samsung phone we observe that the sender sends all the messages, but the receiver receives only few of them and then times out (samsung-no-trace.log, samsung-with-trace.log).

May be worth noting that adding tokio::task::yield_now().await right below the write_to_peer function resolves the issue and the test passes.

Some info on the affected phone:

   Product name:    Galaxy A32 5G
   Model name:      SM-A326B/DS
   Android version: 13
   Kernel version:  4.14.186-27095505
   Android security patch level: 1. August 2024

samsung-cpuinfo.txt samsung-meminfo.txt

To run the test I use

cross test --no-run send_receive --target=aarch64-linux-android
adb -d push ./target/aarch64-linux-android/debug/deps/send_receive-<SOME_HASH> /data/local/tmp/test-quinn
adb -d shell /data/local/tmp/test-quinn send_receive --nocapture

inetic avatar May 15 '25 08:05 inetic