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

Clients starved for large requests #170

Closed
nixme opened this issue Nov 28, 2012 · 4 comments
Closed

Clients starved for large requests #170

nixme opened this issue Nov 28, 2012 · 4 comments

Comments

@nixme
Copy link
Contributor

nixme commented Nov 28, 2012

2.0.0b3, MRI 1.9.3-p194, Rails 3.2.6

In development, some of our assets don't get served completely and eventually the browser times out. Content-Length comes through correctly but puma only sends a portion of the response.

Narrowed it down to syswrite at server.rb#L455 (https://github.com/puma/puma/blob/master/lib/puma/server.rb#L455). For a large asset, e.g. part.bytesize == 705661, but that client.syswrite part only returns 180224.

Even for other large assets, the syswrite always only writes 180224 bytes. For smaller files, everything is fine.

Puma never checks the return value and continues; the client waits on more data.

Any ideas?

@evanphx
Copy link
Member

evanphx commented Nov 28, 2012

That's a bug. It needs to check the return value and call syswrite again with more of the output. #syswrite goes straight to write(2) so it's limited by the OS. This is a simply oversight.

@nixme
Copy link
Contributor Author

nixme commented Nov 29, 2012

I could write a patch? Should all usage of syswrite be checked and looped until fully written, or just the parts that are variable sized?

@evanphx
Copy link
Member

evanphx commented Nov 29, 2012

I'll fix it shortly!

@nixme
Copy link
Contributor Author

nixme commented Nov 29, 2012

Thanks for the quick turnaround!

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