Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fast-listen: port still bound after foreground task stopped with Ctrl-C #86

Closed
jensens opened this issue Apr 10, 2019 · 3 comments · Fixed by #94
Closed

fast-listen: port still bound after foreground task stopped with Ctrl-C #86

jensens opened this issue Apr 10, 2019 · 3 comments · Fixed by #94

Comments

@jensens
Copy link
Member

jensens commented Apr 10, 2019

If run WSGI ./bin/instance fg with http-fast-listen = on on and stop the instance using Ctrl-C, the port ist still bound for a couple of seconds (~10-20). If started before that delay, the instance wont start again with:

Traceback (most recent call last):
  File "/home/jensens/workspace/pro/akifair/parts/instance/bin/interpreter", line 295, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/home/jensens/.buildout/shared-eggs/Zope-4.0b10-py2.7.egg/Zope2/Startup/serve.py", line 219, in <module>
    sys.exit(main() or 0)
  File "/home/jensens/.buildout/shared-eggs/Zope-4.0b10-py2.7.egg/Zope2/Startup/serve.py", line 216, in main
    return command.run()
  File "/home/jensens/.buildout/shared-eggs/Zope-4.0b10-py2.7.egg/Zope2/Startup/serve.py", line 178, in run
    relative_to=base, global_conf=vars)
  File "/home/jensens/.buildout/shared-eggs/Zope-4.0b10-py2.7.egg/Zope2/Startup/serve.py", line 211, in loadserver
    server_spec, name=name, relative_to=relative_to, **kw)
  File "/home/jensens/.buildout/shared-eggs/PasteDeploy-2.0.1-py2.7.egg/paste/deploy/loadwsgi.py", line 261, in loadserver
    return loadobj(SERVER, uri, name=name, **kw)
  File "/home/jensens/.buildout/shared-eggs/PasteDeploy-2.0.1-py2.7.egg/paste/deploy/loadwsgi.py", line 278, in loadobj
    return context.create()
  File "/home/jensens/.buildout/shared-eggs/PasteDeploy-2.0.1-py2.7.egg/paste/deploy/loadwsgi.py", line 715, in create
    return self.object_type.invoke(self)
  File "/home/jensens/.buildout/shared-eggs/PasteDeploy-2.0.1-py2.7.egg/paste/deploy/loadwsgi.py", line 189, in invoke
    context.global_conf, **context.local_conf)
  File "/home/jensens/.buildout/shared-eggs/PasteDeploy-2.0.1-py2.7.egg/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/home/jensens/.buildout/shared-eggs/plone.recipe.zope2instance-6.1.4-py2.7.egg/plone/recipe/zope2instance/ctl.py", line 908, in server_factory
    prebound.bind((host, int(port)))
  File "/home/jensens/.buildout/shared-eggs/waitress-1.2.1-py2.7.egg/waitress/wasyncore.py", line 369, in bind
    return self.socket.bind(addr)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
@jensens jensens changed the title Fast-Listen: port still bound after foregorund task stopped with Ctrl-C fast-listen: port still bound after foreground task stopped with Ctrl-C Apr 10, 2019
@zopyx
Copy link
Member

zopyx commented Apr 17, 2019

Confirmed with Zope 4/Python 3

@dataflake
Copy link
Contributor

This should probably be filed at https://github.com/Pylons/waitress/issues for waitress itself. Maybe move socket cleanup into at atexit hook.

@dataflake
Copy link
Contributor

P.S.: Bjoern has a similar issue and they have an unmerged PR: jonashaag/bjoern#155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants