plone / plone.recipe.zope2instance

zc.buildout recipe to setup and configure a Zope 2 instance.
https://pypi.org/project/plone.recipe.zope2instance
6 stars 23 forks source link

WSGI initialization file breaks existing installations with version 6.7.3 #146

Closed dataflake closed 4 years ago

dataflake commented 4 years ago

It appears that the recipe will now translate the http-address specification from the buildout specification into fast-listen in the WSGI initialization file where it used to write listen. This breaks all existing buildout configurations that specified multiple address/port combinations, which were acceptable for a WSGI listen statement, but fast-listen cannot deal with it and the instance will not start. Serious party foul.

mauritsvanrees commented 4 years ago

Thanks for the warning. cc @ale-rt for the changes in #143.

ale-rt commented 4 years ago

@dataflake can you write an example of buildout configuration that causes the failure?

ale-rt commented 4 years ago

Never mind, I think I got it:

fast-listen = 127.0.0.2:8120 127.0.0.1:8120

breaks the instance like:

  File ".../plone/recipe/zope2instance/ctl.py", line 914, in server_factory
    host, port = kws['fast-listen'].split(':')
ValueError: too many values to unpack (expected 2)

while

listen = 127.0.0.2:8120 127.0.0.1:8120

starts the server properly.

jugmac00 commented 4 years ago

This is twice the same snippet, uh?

ale-rt commented 4 years ago

I tried with this patch:

[ale@emily plone.recipe.zope2instance]$ git diff -w
diff --git a/src/plone/recipe/zope2instance/ctl.py b/src/plone/recipe/zope2instance/ctl.py
index c6fd851..5441e71 100644
--- a/src/plone/recipe/zope2instance/ctl.py
+++ b/src/plone/recipe/zope2instance/ctl.py
@@ -911,7 +911,8 @@ def serve_paste(app, global_conf, **kw):

 def server_factory(global_conf, **kws):
     if 'fast-listen' in kws:
-        host, port = kws['fast-listen'].split(':')
+        for host_port in kws['fast-listen'].split():
+            host, port = host_port.split(':')
             prebound = dispatcher()
             prebound.create_socket(socket.AF_INET, socket.SOCK_STREAM)
             prebound.set_reuse_addr()

The instance starts but it actually listens only on the last host port combination.

I am inclined to revert #143 and update the documentation saying:

What do you think?

ale-rt commented 4 years ago

This is twice the same snippet, uh?

It was ;) Thanks for noticing

ale-rt commented 4 years ago

I am preparing a patch