Skip to content

[Python] Avoid SIGTTOU when importing readline from background process groups - #54

Open
pzhan9 wants to merge 1 commit into
tile-ai:tilelang_mainfrom
pzhan9:pzhang/avoid-readline-sigttou
Open

[Python] Avoid SIGTTOU when importing readline from background process groups#54
pzhan9 wants to merge 1 commit into
tile-ai:tilelang_mainfrom
pzhan9:pzhang/avoid-readline-sigttou

Conversation

@pzhan9

@pzhan9 pzhan9 commented Jul 20, 2026

Copy link
Copy Markdown

Motivation

Importing readline may modify the controlling terminal with tcsetattr. As a result, when TVM is imported from a background process group, the kernel consequently sends SIGTTOU and stops the process, which is undesired.

Changes

Skip the import when this process group is background on its controlling TTY.

In addition, add PTY-based regression tests covering foreground pdb compatibility and background imports.

Testing

PYTHONPATH=$PWD/python pytest \
    --confcutdir=tests/python/all-platform-minimal-test \
    -q tests/python/all-platform-minimal-test/test_runtime_import.py

The background test reproduces a stop from SIGTTOU on the base revision and passes with this change.

@pzhan9
pzhan9 marked this pull request as draft July 20, 2026 22:48
@pzhan9

pzhan9 commented Jul 27, 2026

Copy link
Copy Markdown
Author

@LeiWang1999 is it possible that you could review this PR? It is to fix a bug described in this issue: #55

With this fix, we could revert this patch in torchtitian: pytorch/torchtitan#3950

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant