Page MenuHomePhabricator

make sure control-port-filter-python exceptions end up in journal
Closed, ResolvedPublic

Description

This is an exception I forced by purposely adding a bug for demonstration purposes. (Renaming a respond to espond.)

When running the filter from the command line, once can see any python exception it throws.

----------------------------------------
Exception happened during processing of request from ('10.137.11.1', 45690)
Traceback (most recent call last):
  File "/usr/lib/python3.4/socketserver.py", line 613, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.4/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.4/socketserver.py", line 669, in __init__
    self.handle()
  File "/usr/lib/tor-controlport-filter", line 637, in handle
    restrict_stream_events
  File "/usr/lib/tor-controlport-filter", line 497, in handle_controlport_session
    espond("250 OK")
NameError: name 'espond' is not defined
---------------------------------------

But when one is running it as a systemd service and looks into sudo journalctl -f -u tor-controlport-filter, then python exceptions do not end up in the journal.

Details

Impact
Normal

Event Timeline

Patrick created this task.Jan 12 2017, 10:46 PM

Kindly review
https://github.com/joysn/control-port-filter-python/tree/master/usr/lib
https://github.com/joysn/control-port-filter-python/blob/master/usr/lib/tor-controlport-filter

One line change will make sure that the python exceptions are logged and seen using sudo journalctl -f -u tor-controlport-filter

Patrick closed this task as Resolved.Jan 13 2017, 3:57 PM

Works for me! Merged.

Does -e have any disadvantages? If not, we should probably enable this for sdwdate also.