Improve logging on listener bind

Bug #1704091 reported by syndicut
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rocket Web Server
New
Undecided
Unassigned

Bug Description

Python 3.4.2
Rocket 1.2.5

You can get various exception on bind, in my case it was some issue with ipv6 bind and it was hard to debug without exception message:

ERROR:Rocket.Errors.Port8000:Socket ::1:8000 in use by other process and it won't share.
Traceback (most recent call last):
  File "/app/venv/lib/python3.4/site-packages/rocket/listener.py", line 85, in __init__
    listener.bind((self.addr, self.port))
socket.gaierror: [Errno -9] Address family for hostname not supported

So I suggest this little patch:
--- rocket/listener.py.old 2017-07-13 08:42:54.570297550 +0000
+++ rocket/listener.py 2017-07-13 08:37:40.115524793 +0000
@@ -85,7 +85,7 @@
             listener.bind((self.addr, self.port))
         except:
             msg = "Socket %s:%i in use by other process and it won't share."
- self.err_log.error(msg % (self.addr, self.port))
+ self.err_log.exception(msg % (self.addr, self.port))
         else:
             # We want socket operations to timeout periodically so we can
             # check if the server is shutting down

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.