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 'set_exception' #1903

Closed
james-huang opened this issue May 18, 2017 · 3 comments
Closed

Comments

@james-huang
Copy link

james-huang commented May 18, 2017

PUT request was failing for me (not sure why yet)

2017-05-18 12:01:00,869 69153 client_library.py:35 E Got non 200 response status 413 for PUT request
2017-05-18 12:01:00,870 69153 futures.py:215 E Task exception was never retrieved
future: <Task finished coro=<ClientRequest.write_bytes() done, defined at aiohttp/client_reqrep.py:306> exception=AttributeError("'NoneType' object has no attribute 'set_exception'",)>
Traceback (most recent call last):
  File "aiohttp/client_reqrep.py", line 316, in write_bytes
    yield from self.body.write(writer)
  File "aiohttp/payload.py", line 154, in write
    yield from writer.write(self._value)
  File "aiohttp/http_writer.py", line 294, in drain
    yield from self._stream.drain()
  File "aiohttp/http_writer.py", line 127, in drain
    yield from self._protocol._drain_helper()
  File "asyncio/streams.py", line 211, in _drain_helper
    yield from waiter
  File "uvloop/future.pyx", line 230, in _iter_ (uvloop/loop.c:110600)
  File "uvloop/future.pyx", line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980)
  File "uvloop/future.pyx", line 96, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108829)
concurrent.futures._base.CancelledError

Expected behaviour

conn.protocol.set_exception(new_exc) sets exception

Actual behaviour

conn.protocol is None? seems like that is ok

Steps to reproduce

It's unclear to me if this is a simple if-guard situation so I'm going to skip this for now.
Let me know if you want me to dig into this further or try to create a repo case though.

Your environment

OSX 10.12.4, python 3.5.2

@fafhrd91
Copy link
Member

I think this is simple if-guard. if you could make PR, that would be awesome.

@james-huang
Copy link
Author

Alright, I can give it a shot tonight.
If the procotol is None we should do nothing? or raise?

@fafhrd91
Copy link
Member

we should do nothing.
I think what might happen is conn get some data, then socket get closed, so cancelation get scheduled with event loop, at the same time exception get raised and exception callback get scheduled with event loop, on next loop iteration those callbacks get executed, and first one cleanup protocol attribute but second callback assumes protocol in place. that's my guess, if-guard should be enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants