You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Folder size not calculated (state 'pending') on 32-bit systems #28275
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
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?
Yes, that's what we do here right? OwnCloud central sent me over here. I already put in a lot of research and testing time, without success. So the last alternative is to ask the experts. That's why we're here.
Similar but not exactly same problems: #16742, #13876
@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: select * from oc_filecache where size=-1 (size -1 is the "pending" value)
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.
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.
@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 php cron.php or sudo -uwww-data php cron.php a few times and see if the number of "size = -1" entries in the DB is getting down.
I do find it strange that occ files:scan with path doesn't help. Did you try adding -vvvvvv at the end of the command ? It should show you what folders it's scanning into, see if it goes into the "Pending" folder at all.
No it´s local storage, in standard data directory (/.../owncloud/data).
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 occ files:scan. Let's see what the verbose mode says...
@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.
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.
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)
So an is_numeric() string all the time should work just as well as it being a proper "int" when small and a "string" when big. I guess there will be a little bit of performance difference in what is mostly an int being converted to a string to be passed back and forth, then automagically type-converted to int when used in a calculation.
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
when you need to store the number in a database, then you have to think how best to do it - packed-BCD anyone :)
and there would be some performance overhead for 99.99% of cases where there is 64-bit int available, or a 32-bit system with a small install.
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.
Note that working with integers there might be an overoptimization that might not be worthy: the performance gain we could have by using integers could be lost due to the extra checks we'll need to do. In addition, the code will be more complex and difficult to maintain.
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 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.
Activity
bcutter commentedon Jul 1, 2017
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?
PVince81 commentedon Jul 3, 2017
Asking busy people for fast and free support ?
http://owncloud.org/support
bcutter commentedon Jul 3, 2017
Yes, that's what we do here right? OwnCloud central sent me over here. I already put in a lot of research and testing time, without success. So the last alternative is to ask the experts. That's why we're here.
Similar but not exactly same problems: #16742, #13876
PVince81 commentedon Jul 3, 2017
Can you link to your posts on central if they contain information about your research ?
bcutter commentedon Jul 3, 2017
Of course: https://central.owncloud.org/t/size-of-the-folder-is-pending/1366
PVince81 commentedon Jul 11, 2017
@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:
select * from oc_filecache where size=-1(size -1 is the "pending" value)PVince81 commentedon Jul 11, 2017
and... apologies for my brief moment of weakness.
bcutter commentedon Jul 11, 2017
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.
PVince81 commentedon Jul 11, 2017
@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
php cron.phporsudo -uwww-data php cron.phpa few times and see if the number of "size = -1" entries in the DB is getting down.I do find it strange that
occ files:scanwith path doesn't help. Did you try adding-vvvvvvat the end of the command ? It should show you what folders it's scanning into, see if it goes into the "Pending" folder at all.bcutter commentedon Jul 11, 2017
Thanks for your input, I can work on that.
PVince81 commentedon Jul 11, 2017
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
occ files:scan. Let's see what the verbose mode says...bcutter commentedon Jul 11, 2017
@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 commentedon Jul 31, 2017
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.
41 remaining items
phil-davis commentedon Aug 8, 2017
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)
So an is_numeric() string all the time should work just as well as it being a proper "int" when small and a "string" when big. I guess there will be a little bit of performance difference in what is mostly an int being converted to a string to be passed back and forth, then automagically type-converted to int when used in a calculation.
jvillafanez commentedon Aug 8, 2017
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.
phil-davis commentedon Aug 8, 2017
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
when you need to store the number in a database, then you have to think how best to do it - packed-BCD anyone :)
and there would be some performance overhead for 99.99% of cases where there is 64-bit int available, or a 32-bit system with a small install.
jvillafanez commentedon Aug 8, 2017
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.
Note that working with integers there might be an overoptimization that might not be worthy: the performance gain we could have by using integers could be lost due to the extra checks we'll need to do. In addition, the code will be more complex and difficult to maintain.
individual-it commentedon Aug 8, 2017
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
so that
getSize()would always return a stringPVince81 commentedon Aug 9, 2017
this might go a bit too far just for quick 32-bit compatibility
PVince81 commentedon Aug 9, 2017
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.
PVince81 commentedon Aug 11, 2017
Revert PR here #28649 for the short term
bcutter commentedon Sep 1, 2017
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.
jvillafanez commentedon Sep 4, 2017
There is a backport to stable10 so it will be for 10.0.3, no need to change anything.
lock commentedon Jul 30, 2019
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.