On 12.03.22 14:58, Jookia wrote: > Hello there, > > I've been banging my head against this issue over the years but sat down > and started to debug it today. > > When I try to quit GNU screen, minicom or another serial program it > sometimes hangs for around 30 seconds. > > To reproduce I do this: > > 1. Connect an Arduino Micro with stock LED blink firmware > 2. Run 'screen /dev/ttyACM1 9600' > 3. Type some letters (no response from the board is given) > 4. Quit in some way > > If I skip step 3 (typing letters), the hang does not happen. You have something in the buffer, which the tty layer will try to send. > In userspace the hang happens at a call to close() on the TTY, and using The tty layer is supposed to wait a defined amount of time if a tty needs to drain. This amount (among many other things) is traditionally set with the TIOCSSERIAL ioctl() > perf and ftrace it looks to be spending a lot of time poisoning urbs in > acm_port_shutdown. That is a bit odd. > - Is this a bug? Maybe, but unlikely. If and only it takes much more time than the termios say. > - Can I reduce the timeout somehow? ioctl() TIOCSSERIAL. If that does not work, it's a bug. HTH Oliver