Skip to content

Commit

Permalink
Merge pull request #5136 from pallavibharadwaj/issue_1914
Browse files Browse the repository at this point in the history
descriptive log for port unavailable and port-retries=0
  • Loading branch information
Zsailer authored Jan 7, 2020
2 parents d0a7435 + 5996cdf commit f354740
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,10 +1490,13 @@ def init_webapp(self):
self.http_server.listen(port, self.ip)
except socket.error as e:
if e.errno == errno.EADDRINUSE:
self.log.info(_('The port %i is already in use, trying another port.') % port)
if self.port_retries:
self.log.info(_('The port %i is already in use, trying another port.') % port)
else:
self.log.info(_('The port %i is already in use.') % port)
continue
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
self.log.warning(_("Permission to listen on port %i denied") % port)
self.log.warning(_("Permission to listen on port %i denied.") % port)
continue
else:
raise
Expand All @@ -1502,8 +1505,12 @@ def init_webapp(self):
success = True
break
if not success:
self.log.critical(_('ERROR: the notebook server could not be started because '
if self.port_retries:
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
else:
self.log.critical(_('ERROR: the notebook server could not be started because '
'port %i is not available.') % port)
self.exit(1)

@property
Expand Down

0 comments on commit f354740

Please sign in to comment.