Skip to content

Conversation

sighphyre
Copy link

@sighphyre sighphyre commented Aug 5, 2025

Fixes #3715

Not convinced this is a perfect fix so open to suggestions and feedback here. The docs tests seem to be failing on my fork of master here as well so I don't think it's anything I've done here.

There's no tests for this because I cannot for the life of me find a way to reproduce this with a test harness. But #3715 provides a functioning example of the bug.

Description

This PR introduces a fix for a a timeout issue with streaming proxies like Traefik.

The bug occurs when a client sends an invalid request to the server as a multipart TCP packet. Actix may be able to detect that the request will not succeed, for example due to an invalid header against a request that requires a body, the server will then respond immediately to the client while leaving the body bytes unread. When a second request is made, those body bytes are then read as the first part of the message, causing the server to block until it hits its own timeout threshold, since they can't be parsed as a valid message.

This fix forces a eof to be sent in cases where the request will not receive further processing but bytes remain unread from that request.

@sighphyre sighphyre changed the title fix: force feed eof when there's a hanging body fix: eof hanging bodies on streamed requests Aug 5, 2025
@sighphyre sighphyre marked this pull request as ready for review August 5, 2025 13:50
@ivarconr
Copy link

ivarconr commented Aug 7, 2025

@robjtede this is critical for us to fix. How can we help get this issue resolved?

@robjtede
Copy link
Member

robjtede commented Aug 7, 2025

As it's critical for you, you can use cargo's patching system for your projects for now.

I don't currently have access to my development machine since it was stolen recently so PRs requiring scrutiny like this one are held up atm. Sorry about that.

@ivarconr
Copy link

ivarconr commented Aug 7, 2025

As it's critical for you, you can use cargo's patching system for your projects for now.

I don't currently have access to my development machine since it was stolen recently so PRs requiring scrutiny like this one are held up atm. Sorry about that.

Thanks for your feedback, and I am sorry about your laptop.

@JohnTitor JohnTitor force-pushed the fix/hang-on-invalid-header branch from d19048d to 9b68186 Compare August 22, 2025 10:13
@robjtede
Copy link
Member

prefering #3721 as the fix for #3715

@robjtede robjtede closed this Aug 29, 2025
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.

Client Connection timeouts when running behind loadbalancers
3 participants