Ticket #10906 (closed Bug: fixed+released)

Opened 6 years ago

Last modified 5 years ago

[Windows] "Restart" button on ZMI control panel *stops* the instance

Reported by: kleist Owned by:
Priority: major Milestone: 4.0
Component: General Version:
Keywords: windows Cc: Windows


Plone 4.0 rc1

  • Start the Zope instance either using the Plone Controller, or the command "bin/instance start"
  • From the ZMI Control Panel, click "Restart"

This does not cause a restart, but the server is stopped (as if the button "Shutdown" had been clicked).

Change History

comment:1 Changed 6 years ago by kleist

I've checked in a workaround that hides the "Restart" button on the maintenance control panel:  http://dev.plone.org/plone/changeset/38871.

The "Restart" button is still available on the ZMI Control Panel though (when the Windows service is used), I have no idea of how to suppress it there.

comment:2 Changed 6 years ago by kleist

  • Keywords windows added

An attempt to untangle this:

Clicking the button "Restart" on @@maintenance-controlpanel ...


... calls the view method handle_restart_action() ...


... which asks Zope to shut down and restart the server by calling manage_restart() in ...


The restart is signalled by passing "1" as first argument to shutdown() ...


... which sets "ZServer.exit_code" to 1.

Since this method does "_shutdown_phase = 1", lifetime_loop() terminates and loop() goes on with graceful_shutdown_loop()

ZServer.exit_code becomes the exit code of the whole application, because of "sys.exit(ZServer.exit_code)" in


When the "Shutdown" button is clicked, the same thing happens with the exception that the exit code becomes 0.

So: Nothing magic here. It must be the responsibility of the Windows service to restart the Zope server if it terminates with exit code 1. Stay tuned...

comment:4 Changed 6 years ago by kleist

The reason for this bug (a regression since Plone 3.3.5) is our using subprocess.call() instead of os.execv() in plone.recipe.zope2instance.ctl.AdjustedZopeCmd.do_foreground(), without taking care of its return code.

The fix has two parts:

  1.  http://dev.plone.org/collective/changeset/124118
  1. The generated "bin/instance-script.py" must end with
    if __name__ == '__main__':
        rc = plone.recipe.zope2instance.ctl.main(
            ["-C", 'E:\\buildout\\plone4coredev\\parts\\instance\\etc\\zope.conf']
            + sys.argv[1:])

instead of

if __name__ == '__main__':
        ["-C", 'E:\\buildout\\plone4coredev\\parts\\instance\\etc\\zope.conf']
        + sys.argv[1:])

I don't know how to achive that, though, so I'm passing the ball...

comment:5 Changed 6 years ago by hannosch

Changing the instance-script.py isn't really possible, as it's generated deep inside setuptools.

But why can't you add the sys.exit call into the ctl.py script? Instead of just setting self._exitstatus, you could do a sys.exit(self._exitstatus) right after the try/finally block or am I missing something?

comment:6 Changed 6 years ago by kleist

  • Status changed from new to closed
  • Resolution set to fixed

comment:8 Changed 5 years ago by ctxlken

  • Status changed from closed to reopened
  • Resolution fixed deleted

It doesn't seem that this fix has made its way into the Plone 4.0.1 or 4.0.2 Windows installers yet.

I just confirmed that clicking the 'Restart' button in 4.0.1 on a standalone instance stops the instance and removes the .pid and .lock files, but the instance does not start back up.

I tested the same on a zeo setup for 4.0.2 with the same results.

comment:9 Changed 5 years ago by kleist

  • Status changed from reopened to closed
  • Resolution set to fixed+released

The reporter of  http://dev.plone.org/plone/ticket/11492 has confirmed that the fix *has* made its way into the Plone 4.0.1 / 4.0.2 Windows installers.

comment:10 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.