Bug: cdc_acm blocking write after many small writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I recently submitted this bug to https://bugzilla.kernel.org/ and was redirected here.

Using a Atmel Evo Kit (which is recognized as /dev/ttyACM0).

When writing many small chunks of data to it, it'll block write forever (at least many minutes using select call).
Writing anyway causes errno 11: Resource temporarily not available.

This seems to be a race condition or buffer overflow since adding a small sleep of 1ms between writes (of 1 byte or similar small) defers the point of getting stuck. Without sleep I can push about 240 bytes and with 1ms sleep I get a lot more (e.g. about 105680).

Also writing bigger chunks doesn't seem to produce the problem.
I can't use that as a solution hover since I need to keep the delay as small as possible.
Meaning small packets (often 1 to 3 bytes) and no caching.

The used serial devices has a set baud of 115200 symbols/sec (no parity, 8 bytes, 1 stopbit).

I should also not that I didn't run into the bug writing as much data as possible. I ran 2 writes of 1 byte every 16.667ms (60 Hz) which caused the program to get stuck after about 5-20 seconds. The program is implemented using python, has 2 extra threads but only uses the serial connection (reading and writing) in the main thread.

I also tried different usb ports (separate root hubs).

This bug doesn't exists on my RaspberryPi this bug didn't exist on kernel 4.14.98-v7+ and probably before. The raspberrypi only had the occasional pause when exceeding writing more than the device could handle and resumes asap (as expected).

The same problem also doesn't exists when using a FTDI as well as a CP2102 on my PC.

(I also disabled the ModemManager service which tried to communicate with the device using Hayes (AT) commands.)

There is no kernel log regarding the bug. Tested using USB 2 as as well as USB 3.
Kernel log when plugging in affected device:
[ 6184.123072] usb 2-10.2: New USB device found, idVendor=03eb, idProduct=2404, bcdDevice= 1.00 [ 6184.123076] usb 2-10.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 6184.123078] usb 2-10.2: Product: CDC
[ 6184.123080] usb 2-10.2: Manufacturer: ATMEL ASF
[ 6184.131485] cdc_acm 2-10.2:1.0: ttyACM0: USB ACM device
---


Greetings,
Linus Kaschulla (currently studing, using linux for many years and getting my feed wet with c programming with linux)




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux