No logs when config file lock blocks indefinitely
Nobody has claimed this yet.
- 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
config.phpcannot be locked via the portableflock()function in a way that the function blocks indefinitely (or longer than upstream timeouts)
2a. open Nextcloud instance in a browser OR
2b. runphp 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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