Skip to content

Process pending signals during SimpleQueue waits#8251

Draft
youknowone with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-simplequeue-get-signals
Draft

Process pending signals during SimpleQueue waits#8251
youknowone with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-simplequeue-get-signals

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Blocking queue.SimpleQueue.get() held in a native condition-variable wait could defer Python signal handlers until an item arrived or the timeout expired.

  • Signal-responsive waits

    • Split semaphore waits into 100ms intervals, capped by the caller’s timeout deadline.
    • Run vm.check_signals() between intervals.
  • Deadlock avoidance

    • Release the semaphore mutex before invoking signal handlers, allowing handlers to safely interact with the same queue.
  • Regression coverage

    • Add a Unix signal snippet verifying SIGALRM is handled while SimpleQueue.get() remains blocked.
signal.setitimer(signal.ITIMER_REAL, 0.1)
threading.Thread(target=unblock_later).start()

q.get()  # signal handler runs before unblock_later() enqueues an item

Copilot AI changed the title [WIP] Fix SimpleQueue.get() to check for pending signals while blocked Process pending signals during SimpleQueue waits Jul 11, 2026
Copilot AI requested a review from youknowone July 11, 2026 05:06
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.

_queue.SimpleQueue.get() doesn't check for pending signals while blocked

2 participants