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

AttributeError: 'NoneType' object has no attribute 'feed_appdata' #2546

Closed
binrush opened this issue Nov 22, 2017 · 18 comments
Closed

AttributeError: 'NoneType' object has no attribute 'feed_appdata' #2546

binrush opened this issue Nov 22, 2017 · 18 comments
Assignees
Labels
Milestone

Comments

@binrush
Copy link

binrush commented Nov 22, 2017

Long story short

We have small aiohttp-based running on many customers servers. All errors from these servers are reported to Sentry. There are many errors whitch looks like aiohttp bugs, here's details:

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f3388134400>
transport: <_SelectorSocketTransport closing fd=30 read=idle write=<idle, bufsize=0>>

AttributeError: 'NoneType' object has no attribute 'feed_appdata'
  File "asyncio/sslproto.py", line 637, in _process_write_backlog
    ssldata, offset = self._sslpipe.feed_appdata(data, offset)

Steps to reproduce

Unfortunately, we can not reproduce this issue on our environment and do not have access to affected servers.

Your environment

aiohttp server 2.3.2
Centos 6/7

Please advice

@asvetlov
Copy link
Member

Thanks for report.
The problem is actually in asyncio itself.
I'm trying to write a complex fix for SSL transport but it takes a while.
You can simply ignore this noisy error message.

P.S.
Let's keep the issue open for the reference for a while.

@bigbagboom
Copy link

bigbagboom commented Dec 20, 2017

same error I got:

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x0311ADD0>
transport: <_SelectorSocketTransport closing fd=876 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "C:\Python36\lib\asyncio\sslproto.py", line 638, in _process_write_backlog
    ssldata, offset = self._sslpipe.feed_appdata(data, offset)
AttributeError: 'NoneType' object has no attribute 'feed_appdata'

waiting for the fix. Thanks a lot.

@asvetlov asvetlov added this to the 3.0 milestone Dec 20, 2017
@asvetlov asvetlov self-assigned this Dec 20, 2017
@agronholm
Copy link
Contributor

I hit this one too but not with aiohttp. Is there a relevant issue on CPython's bug tracker?

@asvetlov
Copy link
Member

asvetlov commented Feb 2, 2018

There are several issues related to asyncio ssl support, I'll address them before new Python release.

@thehesiod
Copy link
Contributor

just hit this too

@asvetlov asvetlov modified the milestones: 3.0, 3.1 Feb 12, 2018
@daniel-kukiela
Copy link

I have the same issue, just to let you know :)

@vladiscripts
Copy link

I too.

@thomaszdxsn
Copy link
Contributor

I too. have something temp way fix it? pls

@asvetlov
Copy link
Member

The error is harmless, you could just ignore it.
asyncio tries to write into closed SSL connection and fails -- but nothing is corrupted, the socket is closed successfully etc. Bug fix should just ignore such write tries.
I'll apply the fix to Python 3.6.5

@daniel-kukiela
Copy link

daniel-kukiela commented Feb 23, 2018

It depends.
It harms our voice channel steram using discordpy. I'm not sure if that's because discordpy doesn't handle that error from aiohttp, or aiohttp doesn't handle error from asyncio.
End result - i can't handle that in my code, no indicators that something happend, stream "looks" as usual, like nothing happend, but no data is streamed (i don't even have a way to check and restart stream).
(i'm waiting for a next occurence of that issue to grab full stack and see)

@asvetlov
Copy link
Member

I pretty sure discord problem is not related.

@daniel-kukiela
Copy link

daniel-kukiela commented Feb 23, 2018

The relation is stream breaks and i see that error in console. Or in other words - if that error occurs, stream breaks, but discordpy "doesn't know" about that and is still streaming (no further error of any type, it just "streams" like nothing happend, but of course no data is transferred).
I'll try to find out what and where doesn't handle that properly and update here if necessary.

@asvetlov
Copy link
Member

Socket is closed before displaying the message, writing into closed socket is an error anyway.

@Insoleet
Copy link
Contributor

Insoleet commented Mar 2, 2018

Probably related, additionnaly to the error reported in this issue, I also get such errors :

ERROR:root:Exception in callback SSLProtocol._process_write_backlog()
handle: <Handle SSLProtocol._process_write_backlog()>
Traceback (most recent call last):
  File "/home/inso/.pyenv/versions/3.5.4/lib/python3.5/asyncio/sslproto.py", line 639, in _process_write_backlog
    ssldata = self._sslpipe.do_handshake(
AttributeError: 'NoneType' object has no attribute 'do_handshake'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/inso/.pyenv/versions/3.5.4/lib/python3.5/asyncio/events.py", line 127, in _run
    self._callback(*self._args)
  File "/home/inso/.pyenv/versions/3.5.4/lib/python3.5/asyncio/sslproto.py", line 665, in _process_write_backlog
    self._on_handshake_complete(exc)
  File "/home/inso/.pyenv/versions/3.5.4/lib/python3.5/asyncio/sslproto.py", line 579, in _on_handshake_complete
    sslobj = self._sslpipe.ssl_object
AttributeError: 'NoneType' object has no attribute 'ssl_object'

@Insoleet
Copy link
Contributor

Insoleet commented Mar 9, 2018

Does this error means we need to reinit the Client Session before trying to send new requests ?

@asvetlov
Copy link
Member

asvetlov commented Mar 9, 2018

I guess no. Just ignore all errors that happen on connection closing.

@asvetlov
Copy link
Member

asvetlov commented Mar 10, 2018

Fixed in upstream, please test on Python 3.6.5

@lock
Copy link

lock bot commented Oct 28, 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].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 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

9 participants