fix(http): time out stalled transactions without killing switched protocols - #2009
Open
nickanderson wants to merge 1 commit into
Open
Conversation
|
@nickanderson, start a full client pipeline with:
my commands and optionsYou can prevent me from automatically starting CI pipelines:
You can trigger a client pipeline on multiple prs with:
You can trigger a client pipeline for a specific Mender Client release with:
You can trigger GitHub->GitLab branch sync with:
You can print PR statistics for a repository with:
You can deploy a review app with:
You can run e2e tests against a deployed review app with:
You can cherry pick to a given branch or branches with:
|
nickanderson
marked this pull request as draft
August 4, 2026 19:52
nickanderson
force-pushed
the
cherry-5.0.x-ME-731-http-stream-timeout
branch
from
August 5, 2026 13:19
2c7195f to
936be89
Compare
…tocols A server that accepts a request and never answers left the response read outstanding forever, wedging the client until restart. Arm Beast's stream timeout per operation and disarm it at the 101 Switching Protocols handover -- leaving it armed there closed mender-connect's WebSocket after five minutes and got the previous attempt reverted (MEN-9433). Backport note: common::def_value does not exist on 5.0.x, so it comes over from master too. A plain default member initializer would not do, since Debug builds use C++11, where that stops ClientConfig being an aggregate. Ticket: ME-731 Changelog: Fixed the client hanging indefinitely when a server accepts a request but never sends a response, which left the device unmanageable until it was restarted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Nick Anderson <nick@cmdln.org> (cherry picked from commit c7a9290)
nickanderson
force-pushed
the
cherry-5.0.x-ME-731-http-stream-timeout
branch
from
August 5, 2026 13:34
936be89 to
53ec1d2
Compare
nickanderson
marked this pull request as ready for review
August 5, 2026 16:36
|
Merging these commits will result in the following changelog entries: Changelogsmender (cherry-5.0.x-ME-731-http-stream-timeout)New changes in mender since 5.0.x: Bug Fixes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #2008 to 5.0.x. Both 5.0.5 and 5.1.0 were verified affected, so upgrading is
not a workaround.
A server that accepts a request and then never answers left the response read outstanding
indefinitely, wedging the client silently — alive, no crash, no log output, recoverable only
by restart. The gap was
ReadHeader():AsyncReadNextBodyPartalready had a timer, butnothing bounded the wait for response headers.
This arms Beast's stream timeout before each operation of a transaction and disarms it at
the 101 Switching Protocols handover. That handover is what the previous attempt
(
d8ddf6da/4aa01ee8) got wrong: it left the timeout armed, and Beast'stimeout_handlercalls
close()on expiry regardless of who owns the socket by then, which killedmender-connect's forwarded WebSocket after five minutes and got the fix reverted under
MEN-9433.
Connect is intentionally not covered —
asio::async_connectruns onlowest_layer(), theraw socket, which bypasses the stream timeout entirely.
Why this touches an extra file versus master
src/common/common.hppis included here to bringcommon::def_valueover from master; 5.0.xonly has
def_bool. It is needed for the newClientConfig::stream_timeout_secondsfield.A plain default member initializer would have been smaller but is wrong on this branch:
cmake/build_mode.cmakecompiles Debug with-std=c++11deliberately, and under C++11 adefault member initializer stops
ClientConfigbeing an aggregate — which breakshttp::ClientConfig client_config {"server.localhost.crt"}in the HTTPS tests. That is thesame reason
def_boolalready exists.Tests
Both are red/green verified — each fails when its own half of the fix is removed:
HttpTest.TestStalledResponseTimesOutHttpForwarderTests.ProtocolSwitchSurvivesIdlePastStreamTimeoutThe forwarder already had five
ProtocolSwitch*tests, but all exercise immediate data flow;none left the connection idle, which is why MEN-9433 escaped.
Built on 5.0.x in Debug (the C++11 path, so the aggregate trap above is exercised);
http_testandhttp_forwarder_testpass 58/58 via ctest.End-to-end on 5.0.5 with a stalled
deployments/nextand the reporting customer's statescripts: unpatched logs nothing for 420 s, patched logs
Error while polling for deployment: The operation timed outat exactly t+300 s, runs theSyncError/IdleEnter scripts, and resumes polling.
Ticket: ME-731