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

Fix fds handling after closing + check if loop is closed #59

Merged
merged 2 commits into from
Jan 2, 2016
Merged

Fix fds handling after closing + check if loop is closed #59

merged 2 commits into from
Jan 2, 2016

Conversation

Insoleet
Copy link
Contributor

So, using aiohttp and quamash made me found a difference between asyncio loops behaviour and quamash loops :

When closing the web application, I had uncritical errors :

Exception ignored in: <generator object ServerHttpProtocol.start at 0x7febb8303410>
Traceback (most recent call last):
  File "/home/inso/.pyenv/versions/sakia-env/lib/python3.5/site-packages/aiohttp/server.py", line 306, in start
  File "/home/inso/.pyenv/versions/3.5.0/lib/python3.5/asyncio/selector_events.py", line 563, in close
  File "/home/inso/.pyenv/versions/sakia-env/lib/python3.5/site-packages/quamash/__init__.py", line 405, in remove_reader
AttributeError: 'NoneType' object has no attribute 'pop'

To compare why this didn't happen with a standard asyncio loop, I checked the difference between quamash. And in asyncio event loops, if the loop is closed, the remove writer and reader and returned ( https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/asyncio/selector_events.py#L247 )
When the loop is closed, the add writer and reader methods raise RuntimeError
( https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/asyncio/selector_events.py#L231 )

There is tests in asyncio for these cases :
https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/tests/test_events.py#L1594
https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/tests/test_events.py#L1606

Also, when we close the loop, if it is closed, we should return immediately like asyncio ( https://github.com/python/asyncio/blob/39c135baf73762830148236da622787052efba19/asyncio/base_events.py#L393 )

@harvimt
Copy link
Owner

harvimt commented Jan 2, 2016

There's some style problems in test_qeventloop.py, and I'll fix them before I release this to PyPI.

harvimt added a commit that referenced this pull request Jan 2, 2016
Fix fds handling after closing + check if loop is closed
@harvimt harvimt merged commit 039d06a into harvimt:master Jan 2, 2016
@harvimt harvimt added the bug label Jan 2, 2016
@harvimt harvimt added this to the future milestone Jan 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants