Skip to content

fix: resolve core runtime bugs (tester event loop, /random 500, scheduler crash)#229

Merged
Germey merged 1 commit into
masterfrom
fix/core-runtime-bugs
Jul 4, 2026
Merged

fix: resolve core runtime bugs (tester event loop, /random 500, scheduler crash)#229
Germey merged 1 commit into
masterfrom
fix/core-runtime-bugs

Conversation

@Germey

@Germey Germey commented Jul 4, 2026

Copy link
Copy Markdown
Member

背景

这是 issue 收敛计划的 Phase 1(核心运行期 Bug 修复)。只修 Bug,不动依赖/功能,保证行为稳定。

改动内容

1. /random 返回 500 — ValueError: too many values to unpack

proxypool/utils/proxy.pyconvert_proxy_or_proxiesstr 分支 用了 host, port = data.split(':'),当 Redis 里存在形如 ip:port:port / 多冒号的脏数据时会抛异常,直接导致 /random 500。list 分支早已用 *_ 兜底,这里对齐为 host, port, *_ = data.split(':')

2. ENABLE_TESTER/GETTER/SERVER=false 启动崩溃

proxypool/scheduler.pyfinally 块无条件调用 tester_process.is_alive(),当对应进程被禁用时该变量为 NoneAttributeError。改为判空后再打印状态。

3. tester 在 Python 3.10+ 报错 / 内存增长 / fd 耗尽

proxypool/processors/tester.py

验证

  • 三个文件 py_compile 通过,无 lint 错误。
  • 复现验证:convert_proxy_or_proxies('1.2.3.4:80:90') 由「抛异常」变为返回 1.2.3.4:80;混合列表、正常输入均正常。

影响面

仅内部实现调整,API 行为、评分逻辑、配置项均不变。

- utils/proxy: fix ValueError on multi-colon proxy strings in the str branch of convert_proxy_or_proxies, which made /random return 500 (#218)

- scheduler: guard None process handles in finally so ENABLE_*=false no longer raises AttributeError (#62)

- tester: replace deprecated get_event_loop()/asyncio.wait() with a fresh loop + asyncio.gather to fix 'Passing coroutines is forbidden' on Python 3.10+ (#191, #201)

- tester: reuse one aiohttp session with a bounded connector instead of one per proxy, reducing memory growth and fd exhaustion (#119, #155)

- tester: catch ClientResponseError/ContentTypeError + return_exceptions so bad httpbin responses no longer raise 'Task exception was never retrieved' (#208)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant