Skip to content

Fix json reader stall on http body trailer. - #968

Merged
eynhaender merged 1 commit into
libbitcoin:masterfrom
evoskuil:master
Oct 17, 2026
Merged

eynhaender merged 1 commit into
libbitcoin:masterfrom
evoskuil:master

Conversation

@evoskuil

Copy link
Copy Markdown
Member

A completed json body reader returned zero bytes consumed without an error when beast re-fed the remainder of a Content-Length body, so http::async_read re-posted the same bytes forever. The thread never idled, pinning a pool thread per request and blocking threadpool::join on shutdown. The body is read before dispatch, so this is reachable before authorization with any application/json body whose trailing whitespace arrives in a separate read (Fulcrum sends \r\n inside Content-Length), or with any trailing non-whitespace.

  • rpc reader: a non-terminated singleton (http) consumes trailing whitespace; non-whitespace after completion is jsonrpc_reader_stall when re-fed, otherwise the start of the next stream message.
  • json reader: never writes a completed parser; trailing whitespace is consumed and anything else is extra_data.
  • is_json_whitespace moved to json_body.hpp and shared.

Tests added for both readers. Syntax-checked locally only; not run.

@evoskuil
evoskuil requested a review from eynhaender October 16, 2026 22:41
@evoskuil evoskuil self-assigned this Oct 16, 2026
@evoskuil evoskuil added this to the 4.0 milestone Oct 16, 2026
@evoskuil evoskuil added the bug label Oct 16, 2026
@eynhaender

Copy link
Copy Markdown
Contributor

fix confirmed working

@eynhaender
eynhaender merged commit 0eb1f64 into libbitcoin:master Oct 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants