Skip to content

doctor: false negative for v2ex (SSL EOF error) while API is reachable via curl #514

Description

@BreezeDoo

Summary

agent-reach doctor --json reports v2ex as unreachable with an SSL error, but the V2EX API is fully reachable via curl. The SSL failure is in agent-reach's bundled Python urllib, not in the network.

Environment

  • agent-reach v1.5.0 (Windows 11)
  • China network, no proxy

What doctor reports

status: warn
name: "V2EX 节点、主题与回复"
message: "V2EX API 连接失败(可能需要代理):<urlopen error [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1010)>"
active_backend: null

What's actually true

curl reaches the same endpoint successfully (HTTP 200 in ~2.5s, no proxy):

$ curl -sS -m 8 -o /dev/null -w "http_code=%{http_code} time=%{time_total}s\n" \
    "https://www.v2ex.com/api/topics/hot.json" -H "User-Agent: agent-reach/1.0"
http_code=200 time=2.519745s

Likely root cause

The check uses Python's urllib (the _ssl.c reference in the error confirms this), which hits SSL: UNEXPECTED_EOF_WHILE_READING. curl uses a different TLS stack and succeeds. This is a false negative from the Python SSL environment bundled in the agent-reach executable, not a real connectivity problem. This also contributes to the ~32s doctor runtime (the failing check times out slowly).

Suggested fix

  • Use a more robust HTTP client / TLS config for the connectivity check (e.g. requests with proper cert handling, or shell out to curl).
  • Or catch SSL: UNEXPECTED_EOF_WHILE_READING specifically and retry / fall back instead of reporting the channel as down.

Workaround

Ignore the warn — v2ex is reachable. Use curl directly for V2EX API calls.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions