Commit 9ea2497
committed
fix(serial): remove blocking tcdrain from Drop impl
The Drop impl on SerialInner called tcdrain(), a blocking syscall
that waits for all queued output to be transmitted. If unread data
sits in the kernel buffer with no reader, after a test or during
shutdown, tcdrain blocks indefinitely. This hung
transport::serial::tests::test_concurrent_read_write on macOS,
where tcdrain on a PTY blocks forever with no reader. (On Linux,
tcdrain returns immediately once the slave is closed, masking the
bug.)
Removing the Drop impl is safe for real hardware. write() copies
data into the kernel's output buffer; once it returns, the data is
in kernel space. The tty close path drains pending output for USB
serial devices (controlled by the driver's closing_wait parameter,
default 30 seconds). The tcdrain in Drop was redundant with what
close() already provides for real devices.
Fixes: #461 parent 7942a3d commit 9ea2497
1 file changed
Lines changed: 1 addition & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | 522 | | |
534 | 523 | | |
535 | 524 | | |
| |||
0 commit comments