Skip to content

Conversation

@NickBorgers
Copy link

Summary

  • Extends exception handling in _retry_with_backoff() to catch httpx.ReadError, httpx.WriteError, and httpx.CloseError alongside RemoteProtocolError
  • These errors can occur when parallel requests in get_all_data() share a client and one request destroys the client while others are in-flight
  • All errors now receive the same immediate retry with client recreation strategy

Test plan

  • Added 8 new tests in TestNetworkErrorRetryLogic class covering:
    • ReadError, WriteError, CloseError trigger immediate retry
    • RemoteProtocolError behavior unchanged (regression test)
    • Network errors can recover on retry
    • ConnectError still uses exponential backoff (unchanged)
    • Empty error message handling
    • Client destruction/recreation in context mode
  • All 379 tests pass
  • Pre-commit hooks pass (black, ruff, mypy, pylint, bandit, coverage)
  • Coverage at 92.74% (above 85% threshold)

Fixes #89

🤖 Generated with Claude Code

When parallel requests share a client via get_all_data(), one request
failing can destroy the shared client while others are in-flight. Those
requests then fail with ReadError, WriteError, or CloseError (all
subclasses of NetworkError) which were not being caught by the retry
logic.

This fix extends the exception handling in _retry_with_backoff() to
catch these network errors alongside RemoteProtocolError, applying the
same immediate retry with client recreation strategy.

Fixes SpanPanel#89

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Incomplete fix for RemoteProtocolError - parallel requests cause unhandled NetworkError exceptions

1 participant