Fix proxybroker find hang on Python 3.10+ and ReadTheDocs build failure#196
Conversation
Replace deprecated `asyncio.get_event_loop_policy().get_event_loop()` with `asyncio.new_event_loop()` + `asyncio.set_event_loop()`. The old call emits DeprecationWarning on Python 3.10/3.11 and fails to create a loop on Python 3.12+ (where `get_event_loop()` no longer implicitly creates one when none is running), causing `proxybroker find` to appear stuck as seen in the reported issue. Agent-Logs-Url: https://github.com/bluet/proxybroker2/sessions/e64ce58c-346d-4c63-83d6-f9a0c61ec979 Co-authored-by: bluet <51141+bluet@users.noreply.github.com>
proxybroker find hang caused by deprecated event loop lookup on Python 3.10+
|
@copilot added to allowlist. make sure you completely done proper comprehensive tests and also examined the output accurately. |
Done. Comprehensive verification against the exact scenario from the issue (
Commit: ac9cf38 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot test again. and make sure you get the correct outputs from each command |
Re-ran every subcommand and captured real output on Python 3.12.3. All commands now produce correct output with no DeprecationWarnings and no hang.
Test suites: Commit: ac9cf38 |
|
@copilot fix docs building failure (in GitHub action) |
…tadata regex Agent-Logs-Url: https://github.com/bluet/proxybroker2/sessions/d4af710f-ebcf-4c5d-815e-76e7bc4d9410 Co-authored-by: bluet <51141+bluet@users.noreply.github.com>
Fixed in 02403c2. Root cause: the ReadTheDocs build logs showed Sphinx aborting with __copyright__ = (
"Copyright 2015-2018 Constverum, 2018-2025 BlueT - Matthew Lien - 練喆明"
)Fix: broadened the regex in Local verification (same command RTD runs): Exit 0, zero warnings under |
|
proxybroker find hang caused by deprecated event loop lookup on Python 3.10+proxybroker find hang on Python 3.10+ and ReadTheDocs build failure
|
@copilot why there are still some legacy actions/checks required? |
That's a repository setting, not something I can change from inside this PR. Required status checks are configured under Settings → Branches → Branch protection rules for If you can share which checks you're seeing as "legacy / required" I can tell you which workflow file (if any) still produces them, but removing them from the required list itself needs repo-admin access in the web UI. |
…d_workflow This integration test was flaky across Python versions: it scheduled broker.find() as a task, slept 0.5s, then asserted broker._checker is not None. _checker is set inside find()'s async path, so on slower CI runners (or under heavier startup overhead on a specific Python version) the assertion fired before the task had a chance to run. Both 9e139bd's and 655b774's CI runs hit this on different Python versions; previous master had the same intermittent failure, and PR #196 only partially mitigated it. Replace the sleep-then-assert with a bounded poll: wait up to 5s checking every 100ms for `broker._checker` to become non-None. This removes the race without introducing real latency on healthy runs (typical assertion happens within 100-200ms). Verified locally on Python 3.13 and 3.14: passes deterministically. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

proxybroker findemitsDeprecationWarning: There is no current event loopand hangs on a fresh install (Python 3.10/3.11), and fails outright on 3.12+ whereget_event_loop()no longer implicitly creates a loop.Additionally, the ReadTheDocs build was failing with
KeyError: 'copyright'while evaluatingdocs/source/conf.py.Changes
proxybroker/cli.py: replace the deprecatedasyncio.get_event_loop_policy().get_event_loop()with an explicitnew_event_loop()+set_event_loop(), which is the documented pattern for a script entry point on Python 3.10–3.13.docs/source/conf.py: broaden the metadata-extraction regex so it also matches multi-line parenthesized assignments inproxybroker/__init__.py. The previous single-line-only regex failed to capture__copyright__, which is wrapped in parentheses across multiple lines to satisfyruff formatline-length rules, causing the ReadTheDocs Sphinx build to abort withKeyError: 'copyright'. The updated regex usesre.MULTILINE | re.DOTALLand accepts optional parentheses/whitespace, restoring a successful docs build (verified locally with the samesphinx -T -W --keep-goingcommand RTD runs).