Skip to content

Conversation

@sublimator
Copy link
Contributor

@sublimator sublimator commented Feb 10, 2026

Summary

  • HTTPClient EOF completion leak: handleData logged "Complete." on EOF but never called invokeComplete(), leaking sockets until the 30s deadline timer fired
  • RPCSub unbounded concurrency: sendThread() fired all queued events as concurrent async HTTP connections with no flow control, exhausting FDs

Changes

HTTPClient (src/libxrpl/net/HTTPClient.cpp)

EOF path in handleData now commits remaining response bytes and invokes the completion callback, matching the non-EOF path.

RPCSub (src/xrpld/rpc/detail/RPCSub.cpp)

  • Batched dispatch: up to 32 events per batch on a local io_context with .run() for flow control (same pattern as rpcClient())
  • Queue cap: 16384 events max, drops with warning log including seq and endpoint (consumers detect gaps via seq field)
  • Catch-all exception handler

Cleanup

  • Removed io_context parameter from make_RPCSub signature, constructor, and call site
  • Removed boost/asio/io_context.hpp include from RPCSub.h

Upstream issue

#6341

Test plan

  • Build succeeds
  • Existing tests pass

HTTPClient::handleData logged "Complete." on EOF but never called
invokeComplete(), leaking the socket until the deadline timer fired.
Now commits remaining response bytes and invokes the callback.

RPCSub::sendThread now dispatches up to 32 events per batch on a
local io_context instead of one-at-a-time blocking calls. Adds a
16384-event queue cap with seq-gap detection for slow consumers.
Removes unused io_context parameter from make_RPCSub.
@sublimator sublimator marked this pull request as ready for review February 10, 2026 06:22
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 4.16667% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.9%. Comparing base (db2734c) to head (7b4720b).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/rpc/detail/RPCSub.cpp 4.8% 20 Missing ⚠️
src/libxrpl/net/HTTPClient.cpp 0.0% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6344     +/-   ##
=========================================
- Coverage     79.9%   79.9%   -0.0%     
=========================================
  Files          840     840             
  Lines        65483   65494     +11     
  Branches      7251    7260      +9     
=========================================
- Hits         52332   52317     -15     
- Misses       13151   13177     +26     
Files with missing lines Coverage Δ
src/xrpld/rpc/handlers/Subscribe.cpp 90.5% <ø> (-0.1%) ⬇️
src/libxrpl/net/HTTPClient.cpp 70.7% <0.0%> (-1.2%) ⬇️
src/xrpld/rpc/detail/RPCSub.cpp 37.1% <4.8%> (-8.8%) ⬇️

... and 9 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Cover socket cleanup paths for success, HTTP 500, connection
refused, timeout, server close, concurrent requests, EOF without
Content-Length, and persistent io_context scenarios.
@sublimator
Copy link
Contributor Author

CI needs approval to run on the latest commits (added RPCSub + HTTPClient tests for coverage). Could a maintainer approve the workflow runs?

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.

1 participant