Skip to content

A value of 0 for socket_port should cause CP to bind to an available unused port #645

@ghost

Description

Originally reported by: Anonymous


When socket_port is specified as 0, an exception is thrown as follows:

File
"/localhome/raghu/localwork/cherrypy/svn.cherrypy.org/trunk/cherrypy/_cpserver.py",
line 69, in quickstart
    self.start()
  File
"/localhome/raghu/localwork/cherrypy/svn.cherrypy.org/trunk/cherrypy/_cpserver.py",
line 95, in start
    self._start_http(httpserver)
  File
"/localhome/raghu/localwork/cherrypy/svn.cherrypy.org/trunk/cherrypy/_cpserver.py",
line 118, in _start_http
    self.wait(httpserver)
  File
"/localhome/raghu/localwork/cherrypy/svn.cherrypy.org/trunk/cherrypy/_cpserver.py",
line 159, in wait
    wait_for_occupied_port(*bind_addr)
  File
"/localhome/raghu/localwork/cherrypy/svn.cherrypy.org/trunk/cherrypy/_cpserver.py",
line 247, in wait_for_occupied_port
    raise IOError(msg)
IOError: Port 0 not bound on 'localhost'

I am using the latest code from the trunk. It appears to me that even though wsgiserver is properly passing 0 to socket.bind (and hence binding to an unused port), other parts of the code still use "configured" port which is 0.

Reported by draghuram@gmail.com


Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions