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

uvloop breaks aiohttp's capability of serving static files #50

Closed
diogobaeder opened this issue Aug 24, 2016 · 8 comments
Closed

uvloop breaks aiohttp's capability of serving static files #50

diogobaeder opened this issue Aug 24, 2016 · 8 comments

Comments

@diogobaeder
Copy link

  • uvloop version: 0.5.3
  • python version: 3.5.2
  • platform: Arch Linux / 4.7.1-1-ARCH / x86_64

uvloop breaks aiohttp's capability of serving static files. It makes the server send the response headers after the body.

To run this, have aiohttp and uvloop installed, then run the gist ( https://gist.github.com/diogobaeder/0558c43d785cd82a1ecff553bc583867 ):
$ python uvhttp.py

Then make a request to the app, making sure to get verbose output:
$ curl -v localhost:8765/jquery.js

These are the results I'm getting when serving jQuery:

  1. Without uvloop (correct response): http://pastebin.com/e6ep3g22
  2. With uvloop (bad response): http://pastebin.com/Kg37DXB8

Notice how with uvloop the response headers are sent after the body.

I'm not acquainted with the internals of aiohttp or uvloop, but it seems that the former relies on some parser from asyncio and uvloop seems to replace it by another one that behaves differently.

Any ideas of why this happens? At the moment this is preventing me to use uvloop, unfortunately...

Thanks!

@1st1
Copy link
Member

1st1 commented Aug 24, 2016

What version of aiohttp are you using? AFAIK there was an issue with how aiohttp implemented sendfile, which was fixed not long ago.

cc @asvetlov

@diogobaeder
Copy link
Author

Hi @1st1 ,

Unfortunately I'm already using the latest version, which is 0.22.5. Mind trying it as well, and see if it works fine for you?

Thanks for the quick reply :-)

@asvetlov
Copy link
Contributor

There is aio-libs/aiohttp#1093 issue.
It's still not fixed but very reproducible.
I think aiohttp sends headers into transport's buffer but sendfile sends a content directly through the wire, that's why headers are sent too late.

@diogobaeder
Copy link
Author

diogobaeder commented Aug 25, 2016

Hmmm... makes sense...

Should we close this issue as a duplicate? Want me to refer it in the other one?

[EDIT] Already done, sorry. You can close this one if you want.

@asvetlov
Copy link
Contributor

asvetlov commented Sep 7, 2016

@1st1 please close the issue as aio-libs/aiohttp#1093 is resolved.

@1st1
Copy link
Member

1st1 commented Sep 7, 2016

@asvetlov When will you release aiohttp with this thing fixed?

@asvetlov
Copy link
Contributor

asvetlov commented Sep 7, 2016

@1st1 just after fixing bugs with cookiejar.
In a few days I hope.

@1st1
Copy link
Member

1st1 commented Sep 25, 2016

Closing the issue since it has been resolved in aiohttp.

@1st1 1st1 closed this as completed Sep 25, 2016
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

3 participants