Server: Trash bin: AbstractTrash::getSize() must be of the type integer, float returned

Created on 19 Dec 2018  Â·  54Comments  Â·  Source: nextcloud/server

Steps to reproduce

(I am unsure about this, as I cannot set up another test instance.)

  1. Delete any file
  2. Visit trash bin in app or web interface
    3.

Expected behaviour

The trash bin should open, showing deleted files.

Actual behaviour

In the web client, the trash bin does nothing but show the loading spinner.
The Android app shows an error instead.

Server configuration

Operating system: Raspbian stretch

Web server: Apache 2.4.25-3

Database: MariaDB 10.1.37-0

PHP version: PHP 7.0.30

Nextcloud version: 15.0.0

Updated from an older Nextcloud/ownCloud or fresh install: upgraded from 14.0.4, 13.0.6, 12.0.4

Where did you install Nextcloud from: zip file

Signing status:


Signing status

No errors have been found.

List of activated apps:


App list

Enabled:
  - accessibility: 1.1.0
  - activity: 2.8.2
  - admin_audit: 1.5.0
  - announcementcenter: 3.4.0
  - apporder: 0.6.0
  - audioplayer: 2.5.0
  - bookmarks: 0.14.3
  - bruteforcesettings: 1.3.0
  - calendar: 1.6.4
  - camerarawpreviews: 0.6.3
  - cloud_federation_api: 0.1.0
  - comments: 1.5.0
  - contacts: 3.0.0
  - data_request: 1.2.0
  - dav: 1.8.0
  - event_update_notification: 0.3.1
  - federatedfilesharing: 1.5.0
  - federation: 1.5.0
  - files: 1.10.0
  - files_downloadactivity: 1.4.0
  - files_external: 1.6.0
  - files_markdown: 2.0.5
  - files_pdfviewer: 1.4.0
  - files_sharing: 1.7.0
  - files_texteditor: 2.7.0
  - files_trashbin: 1.5.0
  - files_versions: 1.8.0
  - files_videoplayer: 1.4.0
  - firstrunwizard: 2.4.0
  - gallery: 18.2.0
  - gpxedit: 0.0.10
  - groupfolders: 2.0.2
  - logreader: 2.0.0
  - lookup_server_connector: 1.3.0
  - metadata: 0.8.0
  - news: 13.0.3
  - nextcloud_announcements: 1.4.0
  - notes: 2.5.1
  - notifications: 2.3.0
  - oauth2: 1.3.0
  - password_policy: 1.5.0
  - phonetrack: 0.4.0
  - previewgenerator: 2.0.0
  - provisioning_api: 1.5.0
  - qownnotesapi: 18.11.0
  - ransomware_protection: 1.3.0
  - serverinfo: 1.5.0
  - sharebymail: 1.5.0
  - sharerenamer: 2.3.0
  - spreed: 5.0.0
  - support: 1.0.0
  - survey_client: 1.3.0
  - systemtags: 1.5.0
  - tasks: 0.9.8
  - theming: 1.6.0
  - twofactor_admin: 0.2.0
  - twofactor_backupcodes: 1.4.1
  - twofactor_nextcloud_notification: 1.0.1
  - twofactor_totp: 2.1.0
  - updatenotification: 1.5.0
  - workflow_script: 1.0.0
  - workflowengine: 1.5.0
Disabled:
  - checksum
  - circles
  - cms_pico
  - encryption
  - files_accesscontrol
  - files_rightclick
  - flowupload
  - keeweb
  - ocdownloader
  - polls
  - socialsharing_email
  - user_external
  - user_ldap

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "1",
            "2",
            "3",
            "4",
            "5",
            "6"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/1",
        "htaccess.RewriteBase": "\/",
        "dbtype": "mysql",
        "version": "15.0.0.10",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "loglevel": 1,
        "mail_smtpsecure": "ssl",
        "maintenance": false,
        "theme": "",
        "mysql.utf8mb4": true,
        "updater.release.channel": "stable",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\Movie"
        ],
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "debug": true
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 64

Operating system: Windows 10

Logs

Web server error log


Web server error log

(No errors)

Nextcloud log (data/nextcloud.log)


Nextcloud log

{"reqId":"cz7cQ2vFEo2wFR8K33gm","level":3,"time":"2018-12-19T13:40:33+00:00","remoteAddr":"1.2.3.4","user":"christopher","app":"remote","method":"PROPFIND","url":"\/remote.php\/dav\/trashbin\/christopher\/trash","message":{"Exception":"TypeError","Message":"Return value of OCA\\Files_Trashbin\\Sabre\\AbstractTrash::getSize() must be of the type integer, float returned","Code":0,"Trace":[{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/PropFind.php","line":98,"function":"getSize","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":797,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->","args":["{DAV:}getcontentlength",[{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"},"getSize"]]},{"function":"propFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"propFind"],[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1059,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":981,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["trashbin\/christopher\/trash",["{http:\/\/nextcloud.org\/ns}trashbin-filename","{http:\/\/nextcloud.org\/ns}trashbin-deletion-time","{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http:\/\/owncloud.org\/ns}fileid","{http:\/\/owncloud.org\/ns}permissions","{http:\/\/owncloud.org\/ns}size","{DAV:}getcontentlength","{http:\/\/nextcloud.org\/ns}has-preview","{http:\/\/nextcloud.org\/ns}mount-type","{http:\/\/nextcloud.org\/ns}is-encrypted","{http:\/\/open-collaboration-services.org\/ns}share-permissions","{http:\/\/owncloud.org\/ns}comments-unread"],1]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/apps\/dav\/lib\/Server.php","line":298,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/remote.php","line":163,"args":["\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/html\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","Line":59,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko\/20100101 Firefox\/64.0","version":"15.0.0.10"}

Browser log


Browser log


1. to develop bug

Most helpful comment

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

All 54 comments

Same here, fresh install Nextcloud 15. Is there a clean way to manually remove deleted files?
Edit: I had to clear some space so I just removed all files inside trash folder. The "Deleted files" in web GUI is still not loading.
Edit2: cleared database by using: sudo -u www-data php occ trashbin:cleanup --all-users

It might be related to FileInfo Size Function not converting the data field to integer properly, if it is already float.

Same behaviour with Nextcloud 15.0.2.0.
In error log I found an TypeError:

Return value of OCAFiles_TrashbinSabreAbstractTrash::getSize() must be of the type integer, float returned

/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 78:
OCA\Files_Trashbin\Sabre\AbstractTrash->getSize()

/www/cloud/3rdparty/sabre/dav/lib/DAV/PropFind.php - line 98:
OCA\Files_Trashbin\Sabre\PropfindPlugin->OCA\Files_Trashbin\Sabre\{closure}("*** sensiti ... *")

/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 79:
Sabre\DAV\PropFind->handle("{http://owncloud.org/ns}size", Closure {})

<<closure>>
OCA\Files_Trashbin\Sabre\PropfindPlugin->propFind(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})

/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ OCA\Files_ ... "], [ Sabre\DAV\ ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1059:
Sabre\Event\EventEmitter->emit("propFind", [ Sabre\DAV\ ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 981:
Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1666:
Sabre\DAV\Server->getPropertiesIteratorForPath("trashbin/frank/trash", [ "{http://n ... "], 1)

/www/cloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 355:
Sabre\DAV\Server->generateMultiStatus(Generator {}, false)

<<closure>>
Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:
Sabre\Event\EventEmitter->emit("method:PROPFIND", [ Sabre\HTTP ... }])

/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:
Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/www/cloud/apps/dav/lib/Server.php - line 301:
Sabre\DAV\Server->exec()

/www/cloud/apps/dav/appinfo/v2/remote.php - line 35:
OCA\DAV\Server->exec()

/www/cloud/remote.php - line 163:
require_once("/www/cloud/ ... p")`

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

It works for me too, thanks!

Had the same problem, found this issue by Google, thanks for the exact Nextcloud-log. Solved it by the following answer
https://github.com/nextcloud/server/issues/13160#issuecomment-450574292:

Edit2: cleared database by using: sudo -u www-data php occ trashbin:cleanup --all-users

@bdstr @bzfwunde maybe do an pull request?

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

It works for me too, thanks!

This worked for me
Can you include this in the nextcloud code?

This worked for me
Can you include this in the nextcloud code?

Bad idea. If you running nextcloud on a raspberry pi (and use a 32bit operating system) files larger than ~4gb are to big for int. What is wrong here is the typed return type.

this worked for me too but the files were 2,5 GB not bigger than 4
what happens when deleting files with over 4 GB size?

Same for me, fix doesn´t work cause it´s already applied in AbstractTrash.php.
Running on a Raspberry Pi with NC v15.0.5.3, deleted files totally at least 8 to 9 GB. No way to recover... horrible, I´m lost :-(

Update: When I change the "public function getSize(): int {" to "public function getSize(): float {" in AbstractTrash.php, trashbin page loads immediately. So where the int is a fix for some, it gets me in big troubles. Definitely NOT closed!

@rullzer @MorrisJobke https://github.com/brick/math could be a possible solution. I'm not affected by this problem but it would be cool to have it fixed. Keep in mind you recommend nextcloud for raspberry. Using int for $size will not work there for large files.

This is still a problem in nextcloud version 15.0.8.1. I got around it by editing AbstractTrash.php and putting intval around the return statement for getSize.

I tried using changing the return value to float and that worked too.

I can confirm the problem at the image NextCloudPi_RPi_03-09-19. I updated to nextcloud 16.0.1.1. The trash bin has been unusable after I dropped a 3.8 gb file in it.

I have faced the same issue.
workaroud: sudo -u www-data php occ trashbin:cleanup --all-users
Nextcloud 16.0.1
hardware: Tinkerboard S
OS: Armbian 5.77
kernel: 4.19.41-rockchip
php: 7.2.19

Thx for the info! I can confirm that helped.

Hello,
I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution.
Please, could you clarify?
Thanks

Hello,
I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution.
Please, could you clarify?
Thanks

As openterprise stated the following console command forces the trashbin to empty:
sudo -u www-data php occ trashbin:cleanup --all-users

You either have to login to the nextcloud locally or via ssh.

In my case it is a nextcloudpi and it said it didn't the file occ. In that case I had to change the command to where my occ is, i. e. :
sudo -u www-data php /var/www/nextcloud/occ trashbin:cleanup --all-users

This happend right now (using nextcloud 16.0.3, tarball on Rasbian Buster with PHP 7.3). I started to upload ~8GB of files via WiFi (only images and videos <1GB), cancelled the upload, marked all files and deleted them, switched to LAN, reloaded nextcloud, startet to upload again. I couldn't open the trash bin, neither through the web interface nor the app. The upload was fine, no other errors occured.

Deleting other files moved them to the trash correctly (verified through file system access), but I couldn't delete them.

Using sudo -u www-data php occ trashbin:cleanup <affected user's ID> I was able to regain access to the trash bin.

Same issue just faced on v16.0.4 RC1, on an RPi2.

Same problem here with nextcloud 16.0.3, but workaround is not an option for me, I need to restore folders from the trashbin.

The same issue persists with NC 17 beta 1. Lost some files on the server side after the upgrade and had the same error when I tried to look into the trash bin if they are there. occ trashbin:cleanup --all-users helped to solve this error, but sadly not to regain the files. ;-)

It is "stable" 16.0.4 installed with not trash bin... After applying this correction (thanks you by the way!) have an integrity check error. What a Stable!

This worked for me
Can you include this in the nextcloud code?

Bad idea. If you running nextcloud on a raspberry pi (and use a 32bit operating system) files larger than ~4gb are to big for int. What is wrong here is the typed return type.

Actually ~4gb would be true if if was a signed integer. For normal (unsigned) ones it is 2 147 483 647 bytes on 32 bit systems.

I am experiencing the same kind of error when downloading large folders (#12422). There the only available "fix" there is to use float instead of int as the parameter of a method and live with the integrity check error. I think it is really annoying that such an elementary bug pops up in several places where I never had problems with owncloud...

Btw, I would be prepared to help out but I have no idea where to start...

The file info class (https://github.com/owncloud/core/blob/master/lib/private/Files/FileInfo.php) states in a comment that the size of a file/folder is an int which is just not true on 32 bit systems for files/folders > 2,147,483,647 byte. The question which arises for me is, at how many other places inside the codebase this wrong assumption hides as well.

Same issue here. I must say the nature of the issue is pretty scary, even more considering it's laying around for a long time. Hope someone can address this issue in a sane fashion.

Btw, I would be prepared to help out but I have no idea where to start...

Cool :+1:

https://github.com/nextcloud/server/blob/ce433637dad27e944ff2d78167ba962cb2273bad/apps/files_trashbin/lib/Sabre/AbstractTrash.php#L58-L60

Create a pull request and change public function getSize(): int { to public function getSize() {. This will do it for now. Similar to: https://github.com/nextcloud/server/pull/16636

also still having this problem but on a full fledged 64bit system.
didnt try to apply the fixes yet.
i am up to wait for a sane fix.

also i didnt saw someone mention before.

with tyni users it works. only for the users with loads of trash it doesnt

Same on 17.ß1 fresh install files deleted 4 days ago resit in trashbinbin
:cleanup trashbin:expire --all-users and occ trashbin-:cleanup have no effect,regardless of the order the commands used in.

Same problem for me with Nextcloud 17.0.2.

Still present in latest docker-image for arm. Had to clear it with "php occ trashbin:cleanup --all-users" in container.

If you would have read the issue ticket https://github.com/nextcloud/server/pull/16636, you had seen that the fix is part of NC v18 beta 4 and not NC 17.x 😉

If you would have read the issue ticket #16636, you had seen that the fix is part of NC v18 beta 4 and not NC 17.x wink

It's not merged yet. Probably if someone has time to test and review it.

Just to chime in with my experience on with this issue...

I have 2 Nextcloud 17.0.2 instances (stable):

  1. Rock64 board running 64 bit Armbian Bionic (based on Ubuntu 18.04) OS with Apache, php7.2-fpm, Redis(caching) and MariaDB.

  2. Raspberry pi 3B+ running a 32bit Raspbian Buster OS with Apache, php7.3-fpm, Redis(caching) and MariaDB.

  • Note: I intentionally left out the application versions I am using due to security concerns; if they are needed I can share them privately with the dev team.

I have encountered the issue described here only on the 32 bit Raspbian Buster, which leads me to believe that the root cause is indeed the 64bit/32bit OS version.

Nevertheless, I applied @bzfwunde cast to integer workaround on the 32 bit Raspi3B+ instance and although I had >53GB of deleted files in my trash bin, it successfully loaded the page and allowed me to remove the files from the trash bin via the Nextcloud web UI.

  • Workaround:

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
return (int)$this->data->getSize();
}

Also, here's an extract of my Nextcloud log from the Raspi3B+ when I tried to open the "Deleted files" folder and received the The directory is unavailable, please check the logs or contact the administrator error message:

{"reqId":"Xh261Hc7hn@e3jCnJzxYrQAAABM","level":3,"time":"2020-01-14T14:57:56+02:00","remoteAddr":"XX.XX.XX.XX","user":"WILL-NOT-SHARE-USER","app":"remote","method":"PROPFIND","url":"\/remote.php\/dav\/trashbin\/WILL-NOT-SHARE-USER\/trash","message":{"Exception":"TypeError","Message":"Return value of OCA\\Files_Trashbin\\Sabre\\AbstractTrash::getSize() must be of the type int, float returned","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/PropfindPlugin.php","line":78,"function":"getSize","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/PropFind.php","line":98,"function":"OCA\\Files_Trashbin\\Sabre\\{closure}","class":"OCA\\Files_Trashbin\\Sabre\\PropfindPlugin","type":"->","args":["*** sensitive parameters replaced***"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/PropfindPlugin.php","line":79,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->","args":["{http:\/\/owncloud.org\/ns}size",{"__class__":"Closure"}]},{"function":"propFind","class":"OCA\\Files_Trashbin\\Sabre\\PropfindPlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFolder"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"OCA\\Files_Trashbin\\Sabre\\PropfindPlugin"},"propFind"],[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFolder"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1059,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFolder"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":981,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFolder"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["trashbin\/WILL-NOT-SHARE-USER\/trash",["{http:\/\/nextcloud.org\/ns}trashbin-filename","{http:\/\/nextcloud.org\/ns}trashbin-deletion-time","{http:\/\/nextcloud.org\/ns}trashbin-original-location","{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http:\/\/owncloud.org\/ns}fileid","{http:\/\/owncloud.org\/ns}permissions","{http:\/\/owncloud.org\/ns}size","{DAV:}getcontentlength","{http:\/\/nextcloud.org\/ns}has-preview","{http:\/\/nextcloud.org\/ns}mount-type","{http:\/\/nextcloud.org\/ns}is-encrypted","{http:\/\/open-collaboration-services.org\/ns}share-permissions"],1]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/WILL-NOT-SHARE-DOMAIN.COM\/remote.php\/dav\/trashbin\/WILL-NOT-SHARE-USER\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https:\/\/WILL-NOT-SHARE-DOMAIN.COM\/remote.php\/dav\/trashbin\/WILL-NOT-SHARE-USER\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https:\/\/WILL-NOT-SHARE-DOMAIN.COM\/remote.php\/dav\/trashbin\/WILL-NOT-SHARE-USER\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/WILL-NOT-SHARE-DOMAIN.COM\/remote.php\/dav\/trashbin\/WILL-NOT-SHARE-USER\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php","line":317,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","Line":59,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"17.0.2.1"}

Hi,
I can confirm that this workaround works on my Raspi running
NextCloudPi v1.20.7
with Nextcloud17.0.2.1

@Matei-Ciobotaru

I have encountered the issue described here only on the 32 bit Raspbian Buster, which leads me to believe that the root cause is indeed the 64bit/32bit OS version.

Exactly as discussed further up the thread: 32bit OS mean max 2^32 = 4294967296 byte = 4 GiB that can be handled, as it seems for the summed up size of all files in trashbin. Using int does not allow a single file to be > 4 GiB, while using float does not allow the summed file size to be > 4 GiB? :smile:
Probably there is a way to deal with sizes in KiB right from the beginning and only state/show a single flie size in byte when it's 0 KiB or such...

I updated my docker-container to latest yesterday and still have to perform ""php occ trashbin:cleanup --all-users" to get the trash bin to work again.

https://github.com/nextcloud/server/issues/13160#issuecomment-574193495 worked for me
on Nextcloud 16.0.10.2

https://github.com/nextcloud/server/issues/13160#issuecomment-608334475

I updated my docker-container to latest yesterday and still have to perform ""php occ trashbin:cleanup --all-users" to get the trash bin to work again.

Worked for me, thanks.

Hello,
I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution.
Please, could you clarify?
Thanks

As openterprise stated the following console command forces the trashbin to empty:
sudo -u www-data php occ trashbin:cleanup --all-users

You either have to login to the nextcloud locally or via ssh.

In my case it is a nextcloudpi and it said it didn't the file occ. In that case I had to change the command to where my occ is, i. e. :
sudo -u www-data php /var/www/nextcloud/occ trashbin:cleanup --all-users

On my Raspberry-Pi 2b+ running the Snap version of Nextcloud(Ubuntu Core) version 16 something it returned the error sudo: php: command not found
So I adjusted it to nextcloud.occ format of:
sudo nextcloud.occ trashbin:cleanup --all-users
And that did the trick.

18.0.5 same issue

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

18.0.6 on RPi4 has this issue too. This solution solved my problem

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

18.0.6 on RPi4 has this issue too. This solution solved my problem

This solution works for me on Raspberry Pi4 (Raspian 10 buster).
The caveat is that I have to update this patch ([install path]/apps/files_trashbin/lib/Sabre/AbstractTrash.php) after every NC update.

18.0.7 bug still present and doing fine

I also did this and it works. Makes sense since it won't try and return a float when it's properly casted to be an int, for a function that returns an int. :P

I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:

public function getSize(): int {
    return (int)$this->data->getSize();
}

19.0.1.1 bug still present.

Also, I'm trying to edit the AbstractTrash.php file in the nextcloud snap but it's unwritable because it's in a read-only filesystem. Tried maintenance:mode --on and stopping the nextcloud snap but no luck. Any help on that would be much appreciated since I'd like to patch this bug.

For people with NextCloudPi (aka ultra noobs like me), this is what I did to implement the workaround... (it works for me)

The full file path: /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php

sudo su

cd /var/www/nextcloud/apps/files_trashbin/lib/Sabre/

sudo nano AbstractTrash.php

Then follow instructions by this guy: https://github.com/nextcloud/server/issues/13160#issuecomment-461452417

Then go to the WebGui, refresh, it should work.

Let me sum up the situation:

  • 32 bit platforms are going to stay around for a while, since there are a lot of arm-based boards around, so dropping support for them is not an option
  • int can't be used for file sizes since it overflows after 2^32
  • in some cases the overflow is replaced with a cast to float, but this is wrong too since it lowers the precision

In my opinion, the solution consists in using strings for saving file sizes. Furthermore, the gmp library was recently added as dependency to nextcloud - it saves integers as strings and allows to manipulate them.

What do you think?

(@kesselb, could this be a solution?)

https://github.com/brick/math could be a possible solution.

As abstraction for gmp or bc. I think it will stay like this (halfway broken) for a while and then support for 32 bit is dropped. The amount of work to be done to migrate the relevant code to something like brick/math or gmp* is just to much. Luckily it's not my call to merge some of the patches or drop support for 32 bit ;)

I think for starters the cast to int should be sufficient. I mean, how many will have files over 4 GiB laying in their trashbins? I am not saying it should not be fixed, but priorities should be in order. I am working on a 32 bit platform myself and I guess I am stuck with it for a little while longer. But I fixed this problem by simply using something different if it overflows (think it was some ugly shell code back then, but it shows it IS fixable without dropping support). So I hope this fix will be merged because it's a bit tedious to patch the installation after each and every update. Kind of defeats the whole update from the browser as well since I have to SSH into my box just because of this issue.

tl/dr: please merge the cast to int. After that it's okay to think about the problems it creates. But it surely will fix the trashbin for a lot of users for now!

I stand with @chainria on the fact that this has been causing troubles for a lot of users, and 32bit platforms are still too popular to drop support for them, especially since Nextcloud is mostly used in home environments.

I doubt that Nextcloud is mostly used in home environments, maybe installations but not (paying) users. There are alot of high volume installations referenced on the website. (Siemens, German Goverment, French Government) Anyway, the fix has some implications. Just casting away the float means, you loose information. These implications have to be analyzed and understood and they might not be immediately visible. I guess, this issue is not on the top priority of the payed NC devs and nobody has volunteered to work on this either. If somebody is willing to make the commitment, I doubt that the patch won't get merged. ;-) Maybe it's even better to fail when reaching the 4 GB limit in the trash bin.

I hope somebody will come up with a stat that shows whether home or business, 32bit or 64bit (paying) users are more. Till that time I just want to point out the non-paying users also create value for the NextCloud org by testing in various environments and reporting issues free of charge. If their needs are ignored, they might get pissed off and stop caring about NextCloud in general.

This particular issue is open since almost 2 years, and the amount of comments, workaround discussions clearly show that people are bothered.

In order to put things into perspective and continue discussing in a language that everyone understands, can an expert (NextCloud) PHP dev estimate how much effort in hours it would take to fix this clean or implement a workaround?

If this would be e.g. 1 month effort, costing 10K€, I would understand the hesitation immediately and just give up on this.

Was this page helpful?
0 / 5 - 0 ratings