Skip to content

fix: event loop handler teardown bug - #1704

Merged
jakelorocco merged 1 commit into
generative-computing:mainfrom
jakelorocco:fix/event-loop-teardown
Oct 2, 2026
Merged

jakelorocco merged 1 commit into
generative-computing:mainfrom
jakelorocco:fix/event-loop-teardown

Conversation

@jakelorocco

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes N/A

Description

Cleans up the event loop handler teardown so that it doesn't log a warning when Python has already started tearing down module globals.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
@jakelorocco
jakelorocco requested a review from a team as a code owner October 1, 2026 19:06
@github-actions github-actions Bot added the bug Something isn't working label Oct 1, 2026

@AngeloDanducci AngeloDanducci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@planetf1 planetf1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I reproduced the __del__ warning on main (it needs something like a live daemon thread to keep the module around until shutdown wipes it) and it's gone with this change. One optional note on the test inline.


monkeypatch.setattr(elh, "sys", None)
try:
# Treated as finalization: must not raise, and must not wait on the thread.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, fine to merge as is. Nothing here checks the "must not wait" part: I flipped the fallback to finalizing = False and this test still passed, because _event_loop is None holds either way. Wrapping handler._close_event_loop with mock.patch.object(..., wraps=...) and asserting it was called with join_timeout=0.0 would pin it. I checked that version fails on main and on the flipped fallback.

@jakelorocco
jakelorocco added this pull request to the merge queue Oct 2, 2026
Merged via the queue into generative-computing:main with commit 4c53add Oct 2, 2026
13 checks passed
@jakelorocco
jakelorocco deleted the fix/event-loop-teardown branch October 2, 2026 15:39
gretadolcetti pushed a commit to gretadolcetti/mellea that referenced this pull request Oct 5, 2026
Assisted-by: CLAUDE:OPUS

Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
gretadolcetti pushed a commit to gretadolcetti/mellea that referenced this pull request Oct 5, 2026
Assisted-by: CLAUDE:OPUS

Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
gretadolcetti pushed a commit to gretadolcetti/mellea that referenced this pull request Oct 5, 2026
Assisted-by: CLAUDE:OPUS

Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants