-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Folder size not calculated (state 'pending') on 32-bit systems #28275
Comments
Guys I need a fix for this. Even a (temporary) workaround would be good at the moment. What is the problem here? How does file and folder size calculation work internally in owncloud? What about the database I mentioned above? |
Asking busy people for fast and free support ? |
Can you link to your posts on central if they contain information about your research ? |
That's unnecessarily rude and non-constructive. The man is desperate and in the time you wrote this reaction, you could also have overlooked the problem quickly and made a small suggestion like you did afterwards. If you don't like this platform and its users, quit GitHub and open-source developing. If you don't want to lose the battle against NextCloud, keep playing on this field and try to be nice. Anyway, on topic: I might have the same problem.
|
@FCTURNER were this old folders that suddenly switched to "Pending" ? Or are these newly added big folders ? Are you running on a 32-bit system ? (to exclude potential "large folder handling" issues) Normally for existing local folders (assuming no shares not federated shares), the state should never switch back to "Pending" after the value was already set to something. The code that updates the value runs when modifying the contents of the folder and only adds or substracts integers from that column. So not sure what could cause this. You could check the DB before and after the update: |
and... apologies for my brief moment of weakness. |
No problem @PVince81, we all are humans (most of us :-) ) and I really believe you guys have a lot of work to do here - and I´m happy you do this work for us (users). In my case, OC is running on a Raspberry Pi 2. To add further information, here some of external posts (from OwnCloud Central), so we have all possibly relevant information here: Same problem with v10.0.2.1. Since upgrade from v9.1.6 I was wondering why desktop client showed "0 KB is used" in account tab.
|
@bcutter ok so in your case it's about a SMB external storage. @FCTURNER can you confirm whether you observe the problem only on external storages or also local storage ? @bcutter there is a cron / background job that should process the "size = -1" items in the database in small batches. You could try running I do find it strange that |
Thanks for your input, I can work on that.
|
If the folders were created over Webdav or OC web UI, they should already have the correct size, not "Pending". Are you modifying/adding folders into "owncloud/data" outside of the ownCloud interfaces ? Usually it's not recommanded to use OC that way as OC has no way to detect such changes and you need to resort to |
@PVince81: The affected folders are pretty old (static folder structure) and I´m pretty sure they were created using OC Desktop-Client = WebDAV. Ha, good point, there might be an event related to that scenario ("modifying/adding folders into "owncloud/data" outside of the ownCloud interfaces"): A few days after the update to OC v10 there was a full system (file and folder structure 1:1 from tar backup) and MySQL database restore. Both things (files + database) were exactly the same as before (so files and oc_filecache table fit together). And - important! - I already detected the pending state after the update from OC v9.1.6 to v10.0.2.1, so I´m pretty sure the backup restore isn´t relevant. But to be fair I of course want to provide all information available. So, to summarize: No, adding/modifying/deleting files from the user´s data folders not using standard channels like web or OC desktop client is NOT performed. |
@PVince81 Awesome, thanks.
No, actually local storage only. But I found out that it has nothing to with the It happened as soon as I upgraded from the latest OC 9 to OC 10.01. I didn't edit any file of folder, but after the update all folders with > 1 GB in total showed edit: In addition: calculated folder sizes in pending folders are shown in the web GUI as for example |
Hmmm but the size column is a bigint, so it's 64 bits, it shouldn't be able to wrap back to negative values. That is, unless it's your PHP version that is wrapping back to negative values ? Are you using a 32-bit PHP version by any chance ? There used to be issues with values bigger than 2 GB. |
I do, my system is 32 bit. Is this then expected behaviour on OC10? On OC9 I never had this issue. Even on PHP7.
|
@FCTURNER there was already a fix in place for 32 bit sizes, not sure why it stopped working: #5365, especially this bit here https://github.com/owncloud/core/pull/5365/files#diff-01acafc8091c51ac67a0be326eadfbd4R92. |
Seems like this is the root cause - I guess a Raspberry (running on Raspbian) is 32 bit too (because ARM is 32 bit based). @PVince81: File structure changed since then, can´t find any of those files. Just to finish my TODOs:
So working on the 32 bit / size issue might make some progress. What can I / can we (@FCTURNER + me) do? |
If you have time, setup a second OC instance from git and then do a git bisect between OC 9 (whichever version still worked) and OC 10 (whichever version is broken) to find what change caused the problem. The second approach would be trying to dig into the code and find where the problem appears. It's a bit more complicated because it might require adding more logging in several places to find out what size values are being passed around. |
Update/in addition: Desktop client: "Error transferring ... server replied: Internal Server Error" owncloud.log:
==> Why the hell is this folder missing on the server? Of course the cron can´t calculate the size if the folder doesn´t exist on the server. Helpless 😞 I´ll try to make a directory comparison (endpoint vs. server) next. |
@bcutter likely a different issue. Could be a PHP timeout issue during the move. Run |
OK, but now this specific folder is existing on the server (on an endpoint: moved it to outside OC sync folder, put it back in, forced sync on desktop client). BUT: the appropriate row in oc_filecache is still saying size = -1. So either this has nothing to do with oc_filecache table or those affected rows/folders aren´t updated in oc_filecache. Makes some headache meanwhile... |
Enough testing and hacking for today. Another 3 hours spent without making any progress. Let´s come back to #28275 (comment) |
Alright, first quick fix: Replace For example: $sum = 0 + $sum; will become: $sum = (int)$sum; Now all I'll keep searching for a better solution. |
All parts with "0 +"? I count four. |
Yes, correct. I replaced four items too I guess. Although I think only one of them needed this trick.
Anyway, it’s now less broken than it was before. Does it work for you too?
|
I tried |
Well, not really/fully: Now the pending state is gone and every affected folder simply shows "2 GB" as folder size, but: number of rows with size =-1 in oc_filecache table is still unchanged (290) after several manual cron runs.
So it seems like an optical fix (for the web UI and desktop client folder view), unfortunately not a functional :-( I´m wondering why nobody else puts some work on this (especially your input @FCTURNER, might be a hot lead). I´m only a (technical) user, not a developer. :-( Note for me: I reverted those changes in Cache.php because of fear of any unknown side effects. |
number of rows with size =-1 in oc_filecache table is still unchanged (290) after several manual cron runs.
That must be a different problem, because I have no records with `size = -1`. Maybe you should just backup that table and remove those records. They should be recreated with correct values automatically.
|
So it seems like an optical fix (for the web UI and desktop client folder view), unfortunately not a functional :-(
It *is* partly functional, because they now have values, which allows upload again (in my case). I’m working on a better solution.
|
Ye, we can maybe change the phpdoc and say it returns string, which in fact is int.. but it is a bit workaround, so needs proper explanation. @DeepDiver1975 thoughts on this? |
to check if the size is valid we should use |
Makes sense. Motivation for that change was that the interface defined return as int, so we just need to change it to string and if not numeric throw a exception or sth. |
@mrow4a can you take care of the revert + phpdoc changes ? |
Ok, so the decision is to change interface to return numeric string (verified by is_numeric()) in phpdoc? |
If you insist on verifying, then use |
Guys, reverting is not a good idea.. at least I dont want to sign my name over an interface which returns int or string based on the weather or humor. |
well, PHP returns a string instead of an int based on the platform for big numbers... so much for consistency. Doesn't make it possible to have consistent interfaces. |
I mean, the solution proposed was returning |
Whenever an is_numeric() string is put into a calculation, it is made into a number and the calculation is done. If small enough to fit into the platform MAXINT it happily works like an int. If bigger, then it goes in a float/double. If it overflows double then the answer is double(INF) |
I think the best solution is to return numeric strings as @mrow4a has said. For calculations with sizes, we could try the BC Math extension: http://www.php.net/manual/en/book.bc.php Note that anyway, I expect a lot of changes. |
bcadd() works nicely - feed it 2 is_numeric() strings or int in any combination and length/size and it gives you back the sum as an is_numeric() string |
If the performance loss of using the BC match extension is negligible in every system, I'd just use it without any check. We can create a FileSizeOperations class, or something like that, to wrap all of the size operations and work with the BC match extension transparently. If it really make sense, we can optimize the class to use integers under several circumstances, but anyway, the class would work with string and would return string. |
I thought Doctrine would always return strings regardless of the system (32/64bit) if we use BIGINT in the database https://doctrine-orm.readthedocs.io/projects/doctrine-dbal/en/stable/reference/types.html#bigint |
this might go a bit too far just for quick 32-bit compatibility |
especially for something that worked before but somehow was just inconsistent with the interfaces. It seems that with all this type weirdness it is not possible to have a clean typed interface and at the same type 32-bit compatibility. |
Revert PR here #28649 for the short term |
I just wanted to confirm: I changed the FileInfo.php manually. The PR revert worked, everything back normal now. I´m just wondering what happens on the update to OC v10.0.3... is this revert merged to master or will I need to do the modification of FileInfo.php again after next update? Thank you all so far for your efforts. |
There is a backport to stable10 so it will be for 10.0.3, no need to change anything. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Expected behaviour
Folder size gets calculated correctly for every (sub)folder
Actual behaviour
Since upgrade from v9.1.6 I was wondering why desktop client showed "0 KB is used" in account tab.
First, running occ files:scan made some improvement; now "only" two subfolders aren´t calculated - state "pending". Running occ files:scan for affected user account or even using "--path=/username/files/affected/path" option didn´t fix it.
In MySQL db
"select COUNT(fileid) from oc_filecache where size like "-1""
gives 290 entries; most of them exactly in those two affected subfolders.How can I fix that? Do I need to edit those database rows manually? Can I re-create them, only for the two affected subfolders? As already mentioned, occ files:scan with "--path=/username/files/affected/path" option doesn´t work.
Server configuration
Operating system:
Raspbian Jessie
Web server:
nginx
Database:
MySQL
PHP version:
5.6
ownCloud version: (see ownCloud admin page)
10.0.2.1
Updated from an older ownCloud or fresh install:
Updated from 9.1.6 to 10.0.2.1
Where did you install ownCloud from:
native package from website (no OS repositories)
Signing status (ownCloud 9.0 and above):
few errors
Are you using external storage, if yes which one: local/smb/sftp/...
No, everything local in /owncloud/data/
Are you using encryption: yes/no
no
The text was updated successfully, but these errors were encountered: