Skip to content

Fix event-loop lifetime in process-parallel workers - #556

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
h05632hs-create:fix/persistent-worker-event-loop-public
Oct 29, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
h05632hs-create:fix/persistent-worker-event-loop-public

Conversation

@h05632hs-create

Copy link
Copy Markdown
Contributor

Summary

Fix event-loop lifetime management in OpenEvolve's process-parallel workers.

Repeated asyncio.run() calls can close event loops while cached asynchronous clients retain resources bound to those loops. Subsequent worker operations may then fail with RuntimeError: Event loop is closed.

Changes

  • Introduce a persistent, worker-owned event loop for asynchronous generation and evaluation.
  • Ensure orderly cleanup, including pending-task cancellation, asynchronous generator shutdown, and executor shutdown.
  • Add five regression tests covering repeated calls, loop sharing, exception propagation, cleanup, and task cancellation.

Validation

Tested against upstream commit bcf63da435ed6e89b751bddaf01dbfc0744a5320.

  • Original upstream: 912 tests passed.
  • Patched upstream: 917 tests passed.
  • New lifecycle tests: 5/5 passed.
  • Both full suites used the same isolated Docker dependency environment and were executed without external network access.

Earlier isolated investigations reproduced the event-loop lifecycle failure and supported the repair.

Scope and limitations

The change is limited to openevolve/process_parallel.py and tests/test_worker_loop_lifecycle.py.

The full local unit suite passed, but compatibility with every provider and deployment configuration remains unverified. No performance improvement is claimed.

Feedback on the worker lifecycle and cleanup approach is welcome.

@CLAassistant

CLAassistant commented Oct 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion merged commit 26c84db into algorithmicsuperintelligence:main Oct 29, 2026
5 checks passed
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.

3 participants