Skip to content

[BUG]: test_keyboard_interrupt_during_a_fill_reaches_the_user fails when the test process inherits SIGINT as ignored #3213

Closed

Description

@0z5a

Is this a duplicate?

  • I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct

Type of Bug

Something else (test-only failure)

Component

cuda.core

Describe the bug

cuda_core/tests/test_driver_table.py::test_keyboard_interrupt_during_a_fill_reaches_the_user failed on every run (10/10) when pytest was started as a background job of a non-interactive shell:

AssertionError: NOT INTERRUPTED
  WARNING: cuda-bindings could not load the NVRTC: KeyboardInterrupt

A background job of a non-interactive shell inherits SIGINT as SIG_IGN (SigIgn: 0x7 in /proc/<pid>/status). Python installs its KeyboardInterrupt handler only when SIGINT is not ignored at startup, and PyErr_SetInterruptEx does nothing for an ignored signal. The interrupt that the fill re-arms is therefore dropped, and the child prints NOT INTERRUPTED. The subprocess that _run_code starts inherits the same disposition.

SIGINT state Result
Inherited as ignored 3/3 failed
Restored to SIG_DFL before pytest 3/3 passed
Inherited as ignored, child installs signal.default_int_handler itself 3/3 passed

How to Reproduce

bash -c '( pytest cuda_core/tests/test_driver_table.py -k keyboard_interrupt & ); wait'

Expected behavior

The test passes however pytest was started; the interrupt it re-arms reaches the child as KeyboardInterrupt.

Proposed fix

Have _INTERRUPTED_CHILD call signal.signal(signal.SIGINT, signal.default_int_handler) before it patches the loader, so the test does not depend on how the runner was started. This is a 6-line change; I can open a PR.

The fix was written with Claude Opus 5.5 and reviewed by the contributor.

Environment

GPU: B300 (cc 10.3, x86_64) | driver 610.57.04 | CUDA 13.4.2 (local CTK) | Python 3.12 | cuda-python 2da9c65a

Activity

  1. added
    bugSomething isn't working
    cuda.coreEverything related to the cuda.core module
    P2Low priority - Nice to have
    on Oct 28, 2026
  2. added this to the cuda.core 1.3.0 milestone on Oct 28, 2026
  3. added a commit that references this issue on Oct 28, 2026
    d649075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Low priority - Nice to havebugSomething isn't workingcuda.coreEverything related to the cuda.core moduletriageNeeds the team's attention

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions