moccu / django-omnibus

django-omnibus is a Django library which helps to create websocket-based connections between a browser and a server to deliver messages.
BSD 3-Clause "New" or "Revised" License
70 stars 14 forks source link

./manage.py omnibusd does not handle KeyboardInterrupt exceptions #6

Closed synthead closed 10 years ago

synthead commented 10 years ago

When running ./manage.py omnibusd, if the user hits Ctrl-C, the following stack trace is dumped:

$ ./manage.py omnibusd
^CTraceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3.4/site-packages/omnibus/management/commands/omnibusd.py", line 40, in handle
    ioloop.IOLoop.instance().start()
  File "/usr/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 161, in start
    super(ZMQIOLoop, self).start()
  File "/usr/lib/python3.4/site-packages/tornado/ioloop.py", line 662, in start
    event_pairs = self._impl.poll(poll_timeout)
  File "/usr/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 132, in poll
    z_events = self._poller.poll(1000*timeout)
  File "/usr/lib/python3.4/site-packages/zmq/sugar/poll.py", line 110, in poll
    return zmq_poll(self.sockets, timeout=timeout)
  File "_poll.pyx", line 115, in zmq.backend.cython._poll.zmq_poll (zmq/backend/cython/_poll.c:1678)
  File "checkrc.pxd", line 11, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/_poll.c:1879)
KeyboardInterrupt

omnibus should handle these exceptions and shut down cleanly.

EnTeQuAk commented 10 years ago

Thanks a ton for reporting this! :cake: :star2: :thumbsup: