Skip to content

test_tcflow hangs on DragonFly BSD #154416

Description

@serhiy-storchaka

Bug report

test_termios.test_tcflow hangs on DragonFly BSD. It is not tcflow() itself which hangs, but closing the pseudo-terminal in the cleanup:

Timeout (0:02:00)!
Thread 0x0000000800af30c0 (most recent call first):
  File "Lib/unittest/case.py", line 654 in _callCleanup
  File "Lib/unittest/case.py", line 728 in doCleanups

TCIOFF and TCION transmit STOP and START characters, and nothing reads them from the master side, so closing the slave waits for the output to drain forever. Which action is used matters:

action DragonFly BSD Linux
TCOOFF, TCOON close returns close returns
TCIOFF close blocks close returns
TCION close blocks close returns

Reading the master before closing shows the two characters and unblocks the close:

master had b'\x13\x11'

Discarding them with tcflush(fd, TCOFLUSH) after the tcflow() calls fixes the hang. test_termios then takes 44 ms instead of timing out.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions