I run Nextcloud in a Docker container. I use watchtower to monitor for new images and auto-upgrade the container. Today at midnight it found 24.0.1.1
and attempted to upgrade from 24.0.0.12
. It got stuck so Nextcloud was down. Hereās a log snippet:
app_1 | Conf remoteip disabled.
app_1 | To activate the new configuration, you need to run:
app_1 | service apache2 reload
app_1 | Configuring Redis as session handler
app_1 | Initializing nextcloud 24.0.1.1 ...
app_1 | Upgrading nextcloud from 24.0.0.12 ...
app_1 | Another process is initializing Nextcloud. Waiting 10 seconds...
app_1 | Another process is initializing Nextcloud. Waiting 20 seconds...
app_1 | Another process is initializing Nextcloud. Waiting 30 seconds...
app_1 | Another process is initializing Nextcloud. Waiting 40 seconds...
app_1 | Another process is initializing Nextcloud. Waiting 50 seconds...
app_1 | Another process is initializing Nextcloud. Waiting 60 seconds...
I found a workaround here: [Bug]: Upgrade 23.0.3 to 23.0.4 docker Server does not migrate Ā· Issue #1742 Ā· nextcloud/docker Ā· GitHub
So, yay! Manually deleting nextcloud-init-sync.lock
and restarting the container worked: it was able to resume and complete the upgrade.
My question is about the lock itself. nextcloud-init-sync.lock
seems like a āpersistent lockā, meaning, the presence of that file is used to indicate something else is in-progress. Iām guessing the upgrade somehow stopped halfway (maybe a download timed out? I donāt know).
Is it possible to use an āephemeral lockā instead, such as a call to PHPās flock()
function? Maybe that would be a more robust way to lock during an upgrade.
I searched around the nextcloud/server code a bit and couldnāt find the code responsible for creating and checking this file.