meskarune / notify-push

Push notifications out from a server to multiple clients using libnotify
GNU General Public License v3.0
0 stars 0 forks source link

Handle keyboard interupts moar better #1

Open meskarune opened 7 years ago

meskarune commented 7 years ago

If you kill notify-push-client.py with ctrl c, bad things happen

^C
Fatal write error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fd42aa14dd8>
transport: <_SelectorSocketTransport fd=6>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 762, in write
    n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fd42aa14dd8>
transport: <_SelectorSocketTransport closing fd=6>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 762, in write
    n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/sslproto.py", line 643, in _process_write_backlog
    self._transport.write(chunk)
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 766, in write
    self._fatal_error(exc, 'Fatal write error on socket transport')
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 646, in _fatal_error
    self._force_close(exc)
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 658, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 573, in call_soon
    self._check_closed()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 357, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
merrilymeredith commented 7 years ago

Hi sorry, I was just checking out #lobsters via matrix.org and I've never used its IRC gateway before, so I thought maybe my message on matrix might not have gone through to IRC:

I think you just need to loop.stop() before loop.close()