-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 sending zero byte files after sendfile changes #5380
Conversation
d528957
to
7d78b49
Compare
7d78b49
to
7749c02
Compare
Codecov Report
@@ Coverage Diff @@
## master #5380 +/- ##
==========================================
- Coverage 97.16% 97.15% -0.02%
==========================================
Files 41 41
Lines 8746 8746
Branches 1402 1402
==========================================
- Hits 8498 8497 -1
Misses 129 129
- Partials 119 120 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Changing the sendfile implementation in aio-libs#5157 caused a regression with sending zero byte files, and the test had too much mocking to expose the issue.
7749c02
to
d1763e9
Compare
I'm thinking this will fix the following error that I am seeing a few times per day? 2021-02-08 13:26:25 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 485, in start
resp, reset = await task
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 440, in _handle_request
reset = await self.finish_response(request, resp, start_time)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 591, in finish_response
await prepare_meth(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 241, in prepare
return await self._sendfile(request, fobj, offset, count)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_fileresponse.py", line 96, in _sendfile
await loop.sendfile(transport, fobj, offset, count)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1120, in sendfile
return await self._sendfile_native(transport, file,
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 578, in _sendfile_native
return await self.sock_sendfile(transp._sock, file, offset, count,
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 836, in sock_sendfile
self._check_sendfile_params(sock, file, offset, count)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 889, in _check_sendfile_params
raise ValueError(
ValueError: count must be a positive integer (got 0) |
Yes it should |
I was searching for the same issue and got this page. Could you pls let me know if this will be merge to the live version? I'm running HA 2021.2.3 in docker and seeing the above error in logs... Thanks! |
Hello @asvetlov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Backport to 3.8: 💚 backport PR created✅ Backport PR branch: Backported as #6145 🤖 @patchback |
What do these changes do?
Changing the sendfile implementation in #5157 caused a
regression with sending zero byte files, and the test
had too much mocking to expose the issue.
Are there changes in behavior for the user?
Bugfix only
Related issue number
#5157
#5124
home-assistant/core#42514
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.