Skip to content

"Application data after close notify" regression in 3.5.0 with SSL connection #3477

Closed
@K900

Description

@K900

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

changed the title "Application data after close notify" error with SSL connection "Application data after close notify" regression in 3.5.0 with SSL connection on Jan 2, 2019
aio-libs-bot

aio-libs-bot commented on Jan 2, 2019

@aio-libs-bot

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

scotloach commented on Jan 2, 2019

@scotloach

I've been seeing this as well, with some sites most of my https transfers are failing.

scotloach

scotloach commented on Jan 2, 2019

@scotloach

Pin it to 3.4.4 until this gets cleared.

K900

K900 commented on Jan 2, 2019

@K900
Author

Yep, that's what I've done.

asvetlov

asvetlov commented on Jan 3, 2019

@asvetlov
Member

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

asvetlov commented on Jan 4, 2019

@asvetlov
Member

After git bisect I've found the problematic commit: b20c740
It is the #3361 issue, PR #3362

socketpair

socketpair commented on Jan 4, 2019

@socketpair
Contributor

@mnach We have to fix that. Please be involved.

webknjaz

webknjaz commented on Jan 4, 2019

@webknjaz
Member

@socketpair it looks like after his PR @mnach doesn't have any GH activity. I wouldn't count on him receiving these notifications.

socketpair

socketpair commented on Jan 4, 2019

@socketpair
Contributor

@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.

46 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      "Application data after close notify" regression in 3.5.0 with SSL connection · Issue #3477 · aio-libs/aiohttp