Nextcloud-snap: Maintenance mode not working

Created on 21 Mar 2018  路  9Comments  路  Source: nextcloud/nextcloud-snap

I am running 12.0.5snap2. When I turn on maintenance mode from the CLI it has no effect.

$ sudo nextcloud.occ maintenance:mode --on
Maintenance mode enabled

The response suggests it has worked but the Nextcloud service is completely unaffected.

This was kind of raised in #409 but this got rolled in to #202 which was about maintenance mode being turned off by a refresh.

What I see is that irrespective of refreshes maintenance mode does not work. After turning it on logged in users can carry on their session and new users are still able to log in.

bug fix-in-beta

All 9 comments

Huh, confirmed! Wonder what's going on, here. You're right, I glossed over that detail in #409, thinking that it only happened upon reboot.

Looking into this, maintenance mode does work correctly if I run
snap restart nextcloud.php-fpm
after enabling maintenance mode. It seems there is a reload missing in the current approach.

On another note, similarily to #202, maintenance mode does not survive restart of the whole snap, after a snap restart nextcloud maintenance mode is off, no matter what snap run nextcloud.occ maintenance:mode said it was before that.

Looks like you also need to restart nextcloud.php-fpm after maintenance mode is turned off.

Nowhere in the docs is there mention of needing to restart PHP for this to take effect. I feel like we're missing something.

I have tried it on a non-snap Nextcloud server and the occ maintenance:mode --on works as expected with no need for restarts.

Very odd. I'm not completely sure what occ does in this case, so we'll need to investigate why whatever magic it does doesn't take effect properly when snapped.

Apparently, this bug was backported:
Error is not in 11/stable 4724 11.0.6snap1
Error is not in 11/beta 5921 11.0.6snap1
Error is also in 11/edge 5926 11-2018-03-23

Which would let me guess that this was introduced with the update of php. We should check with the same PHP version 7.1.15 without a snap. (The working version has 7.0.25)

Side note: It should be easy to write a test that checks if maintenance mode is working as expected, we would just need to toggle it and check the http status code of (almost) any request.

Outside of a snap, on ubuntu-artful, which has 7.1.15, maintenance mode works as it should with nextcloud 11.0.6 - I will try with php-fpm now.

This ended up simply being the opcache. We disabled checking timestamps for performance (and because it's impossible to change the contents of the snap), but of course, for some silly reason the config is also a .php file, which changes.

Was this page helpful?
0 / 5 - 0 ratings