nextcloud / nextcloud/server

No logs when config file lock blocks indefinitely

Open
#35,008 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: install and update feature: occ
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description

One of the first things that happens during start is loading and locking config file(s) with flock().
If, for whatever reason, the locking mechanism at the OS level blocks indefinitely, there is no way for the user to have any idea what's actually going on without resorting to advanced debugging.

This is true for both normal operation (via fpm, mod, etc.) and for occ which makes the issue even more frustrating.

The call to the function happens before any kind of reasonable logs are displayed.

In my case config.php is located on a NFS filesystem. The reasons for the unability to acquire the lock are as of yet unknown.

Steps to reproduce
  1. config.php cannot be locked via the portable flock() function in a way that the function blocks indefinitely (or longer than upstream timeouts)
    2a. open Nextcloud instance in a browser OR
    2b. run php occ
Expected behavior

Some kind of unconditional trace or "step-by-step" log should be configurable to be shown even before the config is read, describing the steps taken so far. ex:

Initializing Nextcloud v24.0.6
Looking up config environment...
Config dir found at '/mnt/nfs/nextcloud/config'
Found config files '<list of *.config.php>'
Opening file <file>
Acquiring lock on <file>

at least in occ.

Installation method

Other Community project

Operating system

Other

PHP engine version

PHP 8.0

Web server

Nginx

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
(occ doesn't run, see above)
List of activated Apps
see above
Nextcloud Signing status
see above
Nextcloud Logs
no logs
Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the occ entry point and the startup path that opens config.php and acquires its flock() lock. Reproduce the indefinite-lock scenario if possible, then trace how startup output is emitted before configuration loading. Done means useful early diagnostics are available at least for occ, with the normal web startup path considered as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.