Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix erroneous 500 responses when connection is unclean #2745

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robjtede
Copy link
Member

@robjtede robjtede commented Apr 25, 2022

PR Type

Fix

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

The fix for #2624 tipped the scale too far the other way and caused 500 error responses to get queued. This moves the unclean connection detection to after the responses are queued and adds Connection: close headers.

Expect some minor perf drop (untested) but this is an important fix.

fixes #2695

@robjtede robjtede added A-http project: actix-http B-semver-patch labels Apr 25, 2022
@robjtede robjtede changed the title temp fix erroneous 500 responses when connection is unclean Apr 25, 2022
@robjtede robjtede added this to the actix-web v4.1 milestone Apr 25, 2022
@robjtede robjtede marked this pull request as ready for review April 25, 2022 15:16
connection: close
date: Thu, 01 Jan 1970 12:34:56 UTC

payload dropped
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code retain responses a server gives when a payload is dropped? That is the intended behavior IMO, and is what actix did before 4.0.

@Geometrically
Copy link

Geometrically commented Jun 9, 2022

Regarding my previous comment, I don't think this is the case. We have deployed this fix (from this PR) in production at Modrinth, and users still are getting payload drops on their multipart requests.

This is a really big issue as when the payload drops and actix closes the connection, CORS headers aren't set so we can't access the response. This PR hasn't fixed the bug in my issue.

I feel like the previous approach was a lot better. The previous "fix" was for a very small use case. This issue is affecting big projects like MeiliSearch, and I don't think it fits with the actix architecture.

IMO, if I return an error in my response to a user, they should get that error. The connection shouldn't be instantly closed.

(Sorry if this wording was harsh- it's just a pretty big issue my team and I have been dealing with for the past couple of months)

@robjtede
Copy link
Member Author

robjtede commented Jun 9, 2022

I understand the severity of the issue (we're hitting this at my work as well) and also that this PR is an incomplete fix, hence why it is not merged and released.

I'm going to revert the change that created this problem, which will give us back the other bug that existing in v3 (citation needed) which was relatively less problematic. This will give me and anyone else who wants to try some more time to debug and fix both problems finally.

Expect v4.1 to be out by EOD Thursday.

@Geometrically
Copy link

Thanks a lot for your work on actix 😄

Glad this issue is being fixed and love the work the team is doing. Besides this, actix has been an amazing platform for us to build our API on, and for that I am very thankful ❤️

Can't wait for 4.1!

@Geometrically
Copy link

Hey, I noticed this was moved to v4.2. Is there a fix for this issue being planned? Or at least a fork we can use which resolves it to the prior system?

add changelog

add send error response state

remove comment
@robjtede robjtede mentioned this pull request Jul 24, 2022
5 tasks
@robjtede robjtede marked this pull request as draft July 25, 2022 01:48
@robjtede robjtede modified the milestones: actix-web v4.3, actix-web v4.4 Jan 21, 2023
@robjtede robjtede removed this from the actix-web v4.4 milestone Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-http project: actix-http B-semver-patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actix Multipart Panics & Closes Connection on Early Response
2 participants