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

serving a static mp4 file caused exception #1595

Closed
yinzuojie opened this issue Feb 7, 2017 · 5 comments
Closed

serving a static mp4 file caused exception #1595

yinzuojie opened this issue Feb 7, 2017 · 5 comments
Labels

Comments

@yinzuojie
Copy link

yinzuojie commented Feb 7, 2017

ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\file_sender.py", line 131, in _sendfile_fallback
yield from resp.drain()
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\web_reqrep.py", line 888, in drain
yield from self._resp_impl.transport.drain()
File "D:\soft\prog\python3\python-3.5.1\lib\asyncio\streams.py", line 333, in drain
yield from self._protocol._drain_helper()
File "D:\soft\prog\python3\python-3.5.1\lib\asyncio\streams.py", line 211, in _drain_helper
yield from waiter
File "D:\soft\prog\python3\python-3.5.1\lib\asyncio\futures.py", line 361, in iter
yield self # This tells Task to wait for completion.
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\web_server.py", line 61, in handle_request
resp = yield from self._handler(request)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\web.py", line 249, in _handle
resp = yield from handler(request)
File "D:\prog\comp.lang.python\vmax\webfx2.py", line 330, in response
r = await handler(request)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\web_urldispatcher.py", line 486, in _handle
ret = yield from self._file_sender.send(request, filepath)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\file_sender.py", line 201, in send
yield from self._sendfile(request, resp, f, count)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\file_sender.py", line 137, in _sendfile_fallback
resp.set_tcp_nodelay(True)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\web_reqrep.py", line 737, in set_tcp_nodelay
resp_impl.transport.set_tcp_nodelay(value)
File "D:\soft\prog\python3\python-3.5.1\lib\site-packages\aiohttp\parsers.py", line 254, in set_tcp_nodelay
self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, value)
OSError: [WinError 10038] 在一个非套接字上尝试了一个操作。
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
I'm using py3.5.2, win32, aiohttp 1.3a (master)

request:

GET /static/upload/%E6%B5%99%E6%B1%9F%E8%81%94%E9%80%9Avmax/%E7%94%BB%E7%94%BB2.mp4 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
Accept: /
Referer: http://localhost:8080/static/issue.html?id=1
Accept-Language: zh-CN,zh;q=0.8
Range: bytes=0-

response:
HTTP/1.1 206 Partial Content
Content-Type: video/mp4
Last-Modified: Tue, 03 Jan 2017 02:19:38 GMT
Content-Length: 4201671
Date: Tue, 07 Feb 2017 15:26:24 GMT
Server: Python/3.5 aiohttp/1.3.0a0

the file is 4M, but the console shows only 366KB.
image

I'm just a plain lib user, have no idea how to fix it. only thing to do is waiting this to be fixed.
thanks all~

@fafhrd91
Copy link
Member

fafhrd91 commented Feb 7, 2017

exception is fixed in master. i am not sure about file size, try again with latest master

@yinzuojie
Copy link
Author

now no exception reported, but mp4 file still not correctly served.
only random sized bytes are transfered to browser.

response:
HTTP/1.1 206 Partial Content
Content-Type: video/mp4
Last-Modified: Tue, 03 Jan 2017 02:19:38 GMT
Content-Length: 4201671 █ full is 4M, only ~300KB is transfered at every refresh. video player not working... █
Date: Tue, 07 Feb 2017 15:26:24 GMT
Server: Python/3.5 aiohttp/1.3.0a0

@fafhrd91 fafhrd91 reopened this Feb 8, 2017
@alex-eri
Copy link
Contributor

alex-eri commented Mar 7, 2017

I had 206 response and no content (blank line after headers) in browser. 1.3.1

@alex-eri
Copy link
Contributor

alex-eri commented Mar 9, 2017

To play Video in Chrome/Opera HTTP status Must be 200

alex-eri added a commit to alex-eri/aiohttp that referenced this issue Mar 9, 2017
Need to check RFCs
alex-eri added a commit to alex-eri/aiohttp that referenced this issue Mar 9, 2017
alex-eri added a commit to alex-eri/aiohttp-1 that referenced this issue Mar 12, 2017
fafhrd91 added a commit that referenced this issue Mar 14, 2017
serving a static mp4 file caused exception #1595
fafhrd91 added a commit that referenced this issue Mar 14, 2017
serving a static mp4 file caused exception #1595
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants