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

maybe endless loop in fileupload with firefox #1308

Closed
aiomaster opened this issue Oct 22, 2018 · 2 comments
Closed

maybe endless loop in fileupload with firefox #1308

aiomaster opened this issue Oct 22, 2018 · 2 comments

Comments

@aiomaster
Copy link
Contributor

We have detected an issue using jquery file upload and a github version of rack.
Problem is, that larger fileuploads (larger than 50M) with firefox stop working in the rack middleware and produce 100% CPU load, so it looks like an infinit loop.
We have traced the commit that introduced the behaviour in rack: 534ef35

The interesting stuff is, that the same files work in chrome but not in firefox.
So we compared the Request-Headers and the main difference is, that firefox uses other boundaries in the Content-Type-Header than Chrome.

Example-Header in Chrome:
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarydEXn76YwP9nKSKO3

Example-Header in Firefox:
Content-Type: multipart/form-data; boundary=---------------------------100673423314366417001080588648

This is just a guessing, that the boundary parsing is involved here.

@aiomaster
Copy link
Contributor Author

Ok it boils down to this line, that does not return somehow:

if @sbuf.check_until(@body_regex) # check but do not advance the pointer yet

The content of the @body_regex is:

/(.*?)(
)?\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-84208446911303861091947234149(
|--)/m

I don't know if that helps in a way.

aiomaster added a commit to webit-de/rack that referenced this issue Oct 23, 2018
aiomaster added a commit to webit-de/rack that referenced this issue Oct 25, 2018
aiomaster added a commit to webit-de/rack that referenced this issue Oct 25, 2018
aiomaster added a commit to webit-de/rack that referenced this issue Oct 25, 2018
aiomaster added a commit to webit-de/rack that referenced this issue Dec 5, 2018
aiomaster added a commit to webit-de/rack that referenced this issue Feb 28, 2019
aiomaster added a commit to webit-de/rack that referenced this issue Jan 14, 2020
@jeremyevans
Copy link
Contributor

Fixed by #1309

jeremyevans pushed a commit to jeremyevans/rack that referenced this issue Jan 22, 2020
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

No branches or pull requests

2 participants