Closed
Description
I'm running this code:
import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as sess:
async with sess.get('https://api.scryfall.com/cards/random') as resp:
print(await resp.json())
asyncio.run(main())
With aiohttp 3.5.1 on Arch Linux testing (Python 3.7.2, OpenSSL 1.1.1a).
The request to the same URL goes through correctly with curl, and sometimes (very rarely) with aiohttp, but most of the time aiohttp returns None
and produces the following error:
SSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fa5894fc080>
transport: <_SelectorSocketTransport fd=6 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/usr/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
self._sslobj.unwrap()
File "/usr/lib/python3.7/ssl.py", line 767, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2605)
Edit: this is a regression between 3.4.4 and 3.5.0
Activity
aio-libs-bot commentedon Jan 2, 2019
GitMate.io thinks the contributor most likely able to help you is @asvetlov.
Possibly related issues are #3052 (SSL with closed connections), #3242 (Error), #2822 (Unexpected SSL error (CERTIFICATE_VERIFY_FAILED)), #2497 (ClientSession keep transferring data after closed), and #370 (Server closes connection before sending data).
scotloach commentedon Jan 2, 2019
I've been seeing this as well, with some sites most of my https transfers are failing.
scotloach commentedon Jan 2, 2019
Pin it to 3.4.4 until this gets cleared.
K900 commentedon Jan 2, 2019
Yep, that's what I've done.
asvetlov commentedon Jan 3, 2019
Thanks for the report.
The strange thing is that aiohttp didn't change SSL related code between 3.4 and 3.5 releases, at least intentionally.
asvetlov commentedon Jan 4, 2019
After
git bisect
I've found the problematic commit: b20c740It is the #3361 issue, PR #3362
socketpair commentedon Jan 4, 2019
@mnach We have to fix that. Please be involved.
webknjaz commentedon Jan 4, 2019
@socketpair it looks like after his PR @mnach doesn't have any GH activity. I wouldn't count on him receiving these notifications.
Fix handling of chunked+gzipped response when first chunk does not gi…
socketpair commentedon Jan 4, 2019
@webknjaz, @mnach is my colleague :)
Well, seems, I fix your bug, Now, I'm writing tests and so on. Thanks for sample of code to reproduce it. Also, it seems, your server (or servers) sometimes respond with gzipped, and sometimes with plain responses. This could mean wrong server setup or incoherent configuration.
Fix handling of chunked+gzipped response when first chunk does not gi…
46 remaining items