nextcloud / nextcloud/server

[Bug]: `NodeWrittenEvent` isn't triggering metadata generation

Open
#50,627 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 29-feedback 30-feedback bug feature: filesystem
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description
sudo -u wwwrun php /srv/www/htdocs/nextcloud/occ info:file ./42800D26-43EA-418A-B920-60C5B5ED184D/files/log.1.txt
log.1.txt
  fileid: 292126
  mimetype: text/plain
  modified: January 30, 2025, 3:30:08 PM UTC
  not encrypted
  size: 19 B
  etag: 4b46ff4e2eb1d2f6ac23d73a5d6df09b

The following users have access to the file

42800D26-43EA-418A-B920-60C5B5ED184D:
  /42800D26-43EA-418A-B920-60C5B5ED184D/files/log.1.txt: full permissions
    home storage
kantine:/data/nc_data # sudo -u wwwrun php /srv/www/htdocs/nextcloud/occ -vvv metadata:get 292126

In MetadataRequestService.php line 87:

  [OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException]


Exception trace:
  at /srv/www/htdocs/nextcloud/lib/private/FilesMetadata/Service/MetadataRequestService.php:87
 OC\FilesMetadata\Service\MetadataRequestService->getMetadataFromFileId() at /srv/www/htdocs/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php:141
 OC\FilesMetadata\FilesMetadataManager->getMetadata() at /srv/www/htdocs/nextcloud/core/Command/FilesMetadata/Get.php:108
 OC\Core\Command\FilesMetadata\Get->execute() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /srv/www/htdocs/nextcloud/lib/private/Console/Application.php:213
 OC\Console\Application->run() at /srv/www/htdocs/nextcloud/console.php:102
 require_once() at /srv/www/htdocs/nextcloud/occ:11

metadata:get [--as-array] [--refresh] [--reset] [--] <fileId> [<userId>]
Steps to reproduce

We're trying to get the list of users who have created / altered files recently.
uploading a file as seen above, (log.1.txt) then running the commands on top , does not provide feedback for the creator of the file.

we did test another file , created some time ago, there seems to be activity on it like delete, update , etc.
problem is that there is no pattern to this , some files work , and some not. can we have someone to look at this.

this is indipendent if the file is managed under group folders or in personal folder.

the below is an example of how it should work, but also that example is somehow broken.

Expected behavior
kantine:/data/nc_data # sudo -u wwwrun php /srv/www/htdocs/nextcloud/occ info:file "__groupfolders/45/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf"
_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf
  fileid: 288717
  mimetype: application/pdf
  modified: December 9, 2024, 1:12:13 PM UTC
  not encrypted
  size: 731 KB
  etag: 49c6a6881634c67689484e8d22191e54
  mounted at: /

The following users have access to the file

031AF9F9-C245-4FD8-9545-E28B8E152232:
  /031AF9F9-C245-4FD8-9545-E28B8E152232/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: full permissions
    groupfolder 45
056BF000-C6E0-48A6-9AB6-000BDA3BB11A:
  /056BF000-C6E0-48A6-9AB6-000BDA3BB11A/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
08D103FC-E99A-4FAB-967B-5FD23ED6D6C8:
  /08D103FC-E99A-4FAB-967B-5FD23ED6D6C8/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
13DE32CA-CFA4-4AC9-A9B4-9CD2B8089E9D:
  /13DE32CA-CFA4-4AC9-A9B4-9CD2B8089E9D/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
2D634688-1068-4B0E-9EAC-2D7A6D059E63:
  /2D634688-1068-4B0E-9EAC-2D7A6D059E63/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
42800D26-43EA-418A-B920-60C5B5ED184D:
  /42800D26-43EA-418A-B920-60C5B5ED184D/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: full permissions
    groupfolder 45
5BD45350-CA08-4B4F-B8CC-26038FC529C6:
  /5BD45350-CA08-4B4F-B8CC-26038FC529C6/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: full permissions
    groupfolder 45
75FC774A-9FDA-4B67-8006-F5C6C0DBB4A3:
  /75FC774A-9FDA-4B67-8006-F5C6C0DBB4A3/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
7C0FD544-F248-4E2E-8489-5F09654E0761:
  /7C0FD544-F248-4E2E-8489-5F09654E0761/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
83F1C3EB-5B62-4017-A33B-1702580ECF21:
  /83F1C3EB-5B62-4017-A33B-1702580ECF21/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
860B2C5D-A450-45F6-89ED-9E392B9ABCA0:
  /860B2C5D-A450-45F6-89ED-9E392B9ABCA0/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
975DD133-AB5A-4EAF-92AF-689B5D8F8126:
  /975DD133-AB5A-4EAF-92AF-689B5D8F8126/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
9AC63D7C-04D5-443F-9DAC-1259044E4422:
  /9AC63D7C-04D5-443F-9DAC-1259044E4422/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
BED69887-E814-4462-85C9-9DDF2F68C33D:
  /BED69887-E814-4462-85C9-9DDF2F68C33D/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
C07E08A7-9232-4C9D-9692-9AA40FAAF20C:
  /C07E08A7-9232-4C9D-9692-9AA40FAAF20C/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
C532DE17-B1DE-4C88-A302-8D04E810D660:
  /C532DE17-B1DE-4C88-A302-8D04E810D660/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
F10E223E-E450-4BE8-8A47-19EAD756AD58:
  /F10E223E-E450-4BE8-8A47-19EAD756AD58/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
admin:
  /admin/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: full permissions
    groupfolder 45
Support_jananisri.s:
  /Support_jananisri.s/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
Support_muhammed.n:
  /Support_muhammed.n/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
Support_sasi.m:
  /Support_sasi.m/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
Support_naveenraj.n:
  /Support_naveenraj.n/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
Support_prahitha.t:
  /Support_prahitha.t/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
B52FB32A-014A-48EC-8584-21126B72E0A4:
  /B52FB32A-014A-48EC-8584-21126B72E0A4/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
E14C1073-E137-4BAB-9C60-8172E8A80EE7:
  /E14C1073-E137-4BAB-9C60-8172E8A80EE7/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
Support_abhirami.s:
  /Support_abhirami.s/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
3E4CAF33-5ED0-4146-85C2-9AB8C21C45FE:
  /3E4CAF33-5ED0-4146-85C2-9AB8C21C45FE/files/Support/Deliveries/PDC 3.1.0/PROD_20241206_29df7778/Executed_Processed/_PDC_Update_Procedure_PDC3.1.0_-PROD_07-Dec-2024.pdf: read, update, delete
    groupfolder 45
kantine:/data/nc_data # sudo -u wwwrun php /srv/www/htdocs/nextcloud/occ -vvv metadata:get 288717

In MetadataRequestService.php line 87:

  [OCP\FilesMetadata\Exceptions\FilesMetadataNotFoundException]


Exception trace:
  at /srv/www/htdocs/nextcloud/lib/private/FilesMetadata/Service/MetadataRequestService.php:87
 OC\FilesMetadata\Service\MetadataRequestService->getMetadataFromFileId() at /srv/www/htdocs/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php:141
 OC\FilesMetadata\FilesMetadataManager->getMetadata() at /srv/www/htdocs/nextcloud/core/Command/FilesMetadata/Get.php:108
 OC\Core\Command\FilesMetadata\Get->execute() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /srv/www/htdocs/nextcloud/3rdparty/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /srv/www/htdocs/nextcloud/lib/private/Console/Application.php:213
 OC\Console\Application->run() at /srv/www/htdocs/nextcloud/console.php:102
 require_once() at /srv/www/htdocs/nextcloud/occ:11

metadata:get [--as-array] [--refresh] [--reset] [--] <fileId> [<userId>]
Nextcloud Server version

29

Operating system

Other

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

None

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
kantine:/srv/www/htdocs/nextcloud # sudo -u wwwrun php occ config:list system
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "kantine.domain.com",
            "192.168.21.155",
            "nextcloud.domain.com",
            "claudius.domain.com"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "29.0.11.1",
        "overwritehost": "claudius.domain.com",
        "overwrite.cli.url": "https:\/\/claudius.domain.com",
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "loglevel": 1,
        "default_phone_region": "DE",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR",
            "HTTP_X_FORWARDED"
        ],
        "maintenance": false,
        "theme": "",
        "logtimezone": "UTC",
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "updater.server.url": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "ldapUserCleanupInterval": 5,
        "auth.bruteforce.protection.enabled": false,
        "skeletondirectory": "\/srv\/www\/htdocs\/domain_skeleton",
        "activity_expire_days": 36,
        "activity_use_cached_mountpoints": true,
        "app_install_overwrite": [
            "twainwebscan",
            "onlyoffice"
        ],
        "allow_local_remote_servers": true,
        "defaultapp": "",
        "maintenance_window_start": "23"
    }
}
List of activated Apps
sudo -u wwwrun php occ app:list
Enabled:
  - activity: 2.21.1
  - admin_audit: 1.19.0
  - bruteforcesettings: 2.9.0
  - cloud_federation_api: 1.12.0
  - comments: 1.19.0
  - contactsinteraction: 1.10.0
  - dav: 1.30.1
  - deck: 1.13.3
  - documentserver_community: 0.1.20
  - external: 5.4.1
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.1
  - files_downloadlimit: 2.0.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - groupfolders: 17.0.9
  - logreader: 2.14.0
  - lookup_server_connector: 1.17.0
  - nextcloud_announcements: 1.18.0
  - notifications: 2.17.0
  - oauth2: 1.17.1
  - onlyoffice: 9.5.0
  - password_policy: 1.19.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - serverinfo: 1.19.0
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - support: 1.12.0
  - systemtags: 1.19.0
  - tasks: 0.16.1
  - theming: 2.4.0
  - theming_customcss: 1.18.0
  - twofactor_backupcodes: 1.18.0
  - updatenotification: 1.19.1
  - user_ldap: 1.20.0
  - viewer: 2.3.0
  - workflowengine: 2.11.0
Disabled:
  - circles: 29.0.0-dev (installed 28.0.0)
  - contacts: 6.0.1 (installed 6.0.1)
  - dashboard: 7.9.0 (installed 7.0.0)
  - encryption: 2.17.0
  - files_accesscontrol: 1.19.1 (installed 1.19.1)
  - files_automatedtagging: 1.19.0 (installed 1.19.0)
  - files_downloadactivity: 1.17.0 (installed 1.17.0)
  - files_external: 1.21.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - firstrunwizard: 2.18.0 (installed 1.1)
  - photos: 2.5.0 (installed 1.0.0)
  - spreed: 19.0.11 (installed 19.0.11)
  - survey_client: 1.17.0 (installed 1.10.0)
  - suspicious_login: 7.0.0
  - text: 3.10.1 (installed 2.0.0)
  - twofactor_totp: 11.0.0-dev
  - user_status: 1.9.0 (installed 1.0.1)
  - weather_status: 1.9.0 (installed 1.0.0)
Nextcloud Signing status
No errors have been found.
Nextcloud 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 failing metadata:get trace in lib/private/FilesMetadata/Service/MetadataRequestService.php and follow its calls through lib/private/FilesMetadata/FilesMetadataManager.php and core/Command/FilesMetadata/Get.php. Then trace how NodeWrittenEvent is expected to trigger metadata generation; done means metadata:get returns metadata for newly uploaded files consistently in both personal and group-folder storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.