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'
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 :
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 )