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 'get_extra_info' #3335

Closed
vangheem opened this issue Oct 8, 2018 · 9 comments
Closed

Comments

@vangheem
Copy link

vangheem commented Oct 8, 2018

Long story short

When request object is closed, request.transport is set to None which causes errors if you want to do any introspection on the request afterwards(like simply doing request.url)

Expected behaviour

To be able to call request.url object after it is closed.

Actual behaviour

request.url gives:

File "aiohttp/_helpers.pyx", line 32, in aiohttp._helpers.reify.__get__
  File "aiohttp/_helpers.pyx", line 26, in aiohttp._helpers.reify.__get__
  File "/Users/nathan/wildcard/castle/lib/python3.6/site-packages/aiohttp/web_request.py", line 351, in url
    url = URL.build(scheme=self.scheme, host=self.host)
  File "aiohttp/_helpers.pyx", line 32, in aiohttp._helpers.reify.__get__
  File "aiohttp/_helpers.pyx", line 26, in aiohttp._helpers.reify.__get__
  File "/Users/nathan/wildcard/castle/lib/python3.6/site-packages/aiohttp/web_request.py", line 295, in scheme
    if self.transport.get_extra_info('sslcontext'):
AttributeError: 'NoneType' object has no attribute 'get_extra_info'

Steps to reproduce

  • create server
  • finish request
  • create new asyncio task with reference request object

Your environment

  • Python 3.3.6
  • aiohttp 3.4.4

extra

Similar to #816

workaround

If you call request.url before the request is closed, it will be cached and you will not get this error.

@aio-libs-bot
Copy link

GitMate.io thinks possibly related issues are #2231 (AttributeError: 'NoneType' object has no attribute 'errno'), #1903 (AttributeError: 'NoneType' object has no attribute 'set_exception' ), #340 (AttributeError: 'NoneType' object has no attribute 'handle_expect_header'), #2840 (AttributeError: module 'asyncio' has no attribute 'current_task'), and #2546 (AttributeError: 'NoneType' object has no attribute 'feed_appdata').

@asvetlov
Copy link
Member

asvetlov commented Oct 8, 2018

Sorry. I dont follow what introspection are you talking about

@vangheem
Copy link
Author

vangheem commented Oct 8, 2018

@asvetlov updated to hopefully be more clear.

Basically, calling request.url after the request is closed gives this error.

@asvetlov
Copy link
Member

asvetlov commented Oct 8, 2018

Please check aiohttp master.
The issue should be fixed by #3177

@tmendo
Copy link

tmendo commented Oct 16, 2018

@asvetlov is this not supposed to work with Pyhon 3.5.5? I tested it and got the same error as before:

Stopping asyncio loop on unhandled exception: AttributeError. Traceback (most recent call last): ['  File "/usr/lib64/python3.5/asyncio/sslproto.py", line 637, in _process_write_backlog\n    ssldata, offset = self._sslpipe.feed_appdata(data, offset)\n'] AttributeError: 'NoneType' object has no attribute 'feed_appdata'
pip list

Package           Version   
----------------- ----------
aio-pika          4.0.0     
aiohttp           3.4.4  
...

@tmendo
Copy link

tmendo commented Oct 16, 2018

Read somewhere that the fix was not backported..so it requires 3.6.5

@asvetlov
Copy link
Member

@tmendo you are talking about the completely different bug.
Please, next time keep an issue-per-problem principle.

Anyway, regarding your question: no, the fix wan not backported because Python 3.5 is in security maintenance mode now. It means that only the Release Manager (Larry Hastings in this case) can choose what bugfixes to backport, and he should have a Very Serious Reason to do it. Basically, 3.5 is closed for bugfixes except for security vulnerabilities.

I personally was the reviewer and committer for this particular bug; the best I can advise is migrating to 3.6 (or even 3.7, 3.7.1 will be published in a week).

@asvetlov
Copy link
Member

Close as fixed, will be published as a part of aiohttp 3.5 release

@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.
Projects
None yet
Development

No branches or pull requests

4 participants