Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: (Files) After uploading a file, the files list becomes empty #49830

Open
5 of 8 tasks
lufer22 opened this issue Dec 12, 2024 · 5 comments
Open
5 of 8 tasks

[Bug]: (Files) After uploading a file, the files list becomes empty #49830

lufer22 opened this issue Dec 12, 2024 · 5 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug feature: files needs info stale Ticket or PR with no recent activity

Comments

@lufer22
Copy link

lufer22 commented Dec 12, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

The files list becomes empty after uploading something to it.
I researched what was causing this and solved it by accessing the database and deleting some rows from the oc_filecache table.
When I ran the query DELETE FROM oc_filecache WHERE path LIKE '%preview%', the files appeared again, but sometimes I needed to run occ files:scan --all to completely solve the problem.

However, after some time, the list became empty again, probably due to a background job.

When I executed occ preview:repair, the problem reappeared.

Before uploading:
Image

After uploading:
Image

I managed to simulate the problem using the upload button, but it seems to occur when I run the files:scan or preview:repair commands.
I know it's confusing, but I don't know where to find the solution for this.

Steps to reproduce

  1. Open the Files app.
  2. Upload a file.
  3. Observe that the files list becomes empty.

Expected behavior

Upload the files and see them listed normally.

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

MariaDB

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

Upgraded to a MAJOR version (ex. 28 to 29)

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

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "log_type": "file",
        "logfile": "\/var\/log\/groupware\/groupware_s4.log",
        "loglevel": 0,
        "logdateformat": "F d, Y H:i:s",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "default_language": "pt",
        "default_locale": "pt_BR",
        "dbtype": "mysql",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "allow_local_remote_servers": true,
        "lost_password_link": "disabled",
        "simpleSignUpLink.shown": false,
        "updater.release.channel": "git",
        "upgrade.disable-web": true,
        "updatechecker": false,
        "has_internet_connection": false,
        "trashbin_retention_obligation": "auto,10",
        "knowledgebaseenabled": false,
        "profile.enabled": false,
        "allow_user_to_change_display_name": false,
        "auth.bruteforce.protection.enabled": false,
        "activity_expire_days": 30,
        "app.mail.verify-tls-peer": false,
        "auth.webauthn.enabled": false,
        "overwriteprotocol": "https",
        "appstoreenabled": false,
        "user_backends": [
            {
                "class": "\\OCA\\UserExternal\\IMAP",
                "arguments": [
                    "127.0.0.1",
                    143,
                    null,
                    null,
                    false,
                    false
                ]
            }
        ],
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "0",
            "password": "***REMOVED SENSITIVE VALUE***",
            "dbindex": 0,
            "timeout": 1.5,
            "read_timeout": 1.5
        },
        "memcached_server": [
            "localhost",
            "\/tmp\/memcached.sock"
        ],
        "theme": "",
        "trusted_domains": [
            "localhost",
            "devlucas.internetcontrolada.com"
        ],
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpstreamoptions": {
            "ssl": {
                "allow_self_signed": true,
                "verify_peer": false,
                "verify_peer_name": false
            }
        },
        "version": "30.0.4.1",
        "maintenance": false
    }
}

List of activated Apps

Enabled:
  - activity: 3.0.0
  - calendar: 5.0.6
  - calendar_resource_management: 0.8.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contacts: 6.1.1
  - contactsinteraction: 1.11.0
  - dashboard: 7.10.0
  - dav: 1.31.1
  - deck: 1.14.2
  - federatedfilesharing: 1.20.0
  - files: 2.2.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - provisioning_api: 1.20.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - snappymail: 2.38.2
  - spreed: 20.1.0
  - systemtags: 1.20.0
  - tasks: 0.16.1
  - theming: 2.5.0
  - theming_customcss: 1.17.0
  - twofactor_backupcodes: 1.19.0
  - updatenotification: 1.20.0
  - user_external: 3.4.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - encryption: 2.18.0
  - federation: 1.20.0 (installed 1.20.0)
  - files_external: 1.22.0
  - files_versions: 1.23.0 (installed 1.23.0)
  - notify_push: 0.7.0
  - profile: 1.0.0
  - testing: 1.20.0
  - twofactor_totp: 12.0.0-dev
  - user_ldap: 1.21.0
  - user_migration: 7.0.1

Nextcloud Signing status

Nextcloud Logs

Additional info

No response

@lufer22 lufer22 added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 12, 2024
@joshtrichards
Copy link
Member

Anything notable about the filename?

What appears in your Nextcloud log?

Also, check your browser inspector Console and Network tab for possible clues.

@lufer22
Copy link
Author

lufer22 commented Jan 6, 2025

Hey!

Sorry for the delayed response.

Anything notable about the filename?
I tested files with '-' and '_' in their names.
This issue is a bit confusing because I simulated it with and without these characters, and it still occurred. Therefore, I don't believe the filename has any effect.

What appears in your Nextcloud log?
When I upload a file, I usually get this exception, but it doesn't happen every time:
Image

However, this exception occurs more frequently:
Image

Also, check your browser inspector Console and Network tab for possible clues.
I checked the browser Console and Network tabs, but no errors were found:
Image

After uploading a file, the file list remains empty:
Image

Hope it helps!

@edgarlemke
Copy link

edgarlemke commented Jan 22, 2025

Hi there.
For context I work in the same team as of @lufer22 .
After dwelling a long time on this bug, it seems to be a database-related thing. I've even opened an issue on MariaDB bug tracking. So not sure it's a Nextcloud bug.

To fix it, we've done the following:

diff --git a/lib/private/Files/Cache/CacheQueryBuilder.php b/lib/private/Files/Cache/CacheQueryBuilder.php
index 76eb2bfa5ca..00035b67494 100644
--- a/lib/private/Files/Cache/CacheQueryBuilder.php
+++ b/lib/private/Files/Cache/CacheQueryBuilder.php
@@ -94,7 +94,9 @@ class CacheQueryBuilder extends ExtendedQueryBuilder {
                        $alias = '';
                }
 
-               $this->andWhere($this->expr()->eq("{$alias}parent", $this->createNamedParameter($parent, IQueryBuilder::PARAM_INT)));
+               $this->createNamedParameter($parent, IQueryBuilder::PARAM_INT);
+               $eq = "CAST({$alias}parent AS SIGNED) = :dcValue1";
+               $this->andWhere($eq);
 
                return $this;
        }

It's hackish but it seems to work. Any suggestions would be appreciated.

However I find it very smelly that the parent column in the filecache table can receive -1 as a value. Is there a reason for using a negative value for signaling a missing parent? Why not just NULL? Assuming -2, -3... are not expected values, it also has the disadvantage of wasting half the space of the 64 bit representation space of the BIGINT. Even if it's probably not going to be used anyway, it kinda obscures the intention.

@joshtrichards
Copy link
Member

joshtrichards commented Jan 22, 2025

Good catch, but according to your MariaDB bug report you're using MariaDB 11.1.2 which is not supported by MariaDB at this point (and Nextcloud Server never supported it).

11.1.2

This is short-term only release. And outdated even within the 11.1.x series, since the last bug fix release was 11.1.6.

We only support the usage of long-term MariaDB database versions with Nextcloud Server.

For what it's worth, the query as-is works for me in my test environments (in supported and up-to-date MariaDB versions).

So it does appear to have been a MariaDB bug, but also one that is (a) since fixed; (b) possibly avoidable by sticking with supported long-term releases. ;-)

Refs:

@nextcloud-command
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

@nextcloud-command nextcloud-command added the stale Ticket or PR with no recent activity label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 30-feedback bug feature: files needs info stale Ticket or PR with no recent activity
Projects
None yet
Development

No branches or pull requests

5 participants