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

Negative file sizes in cached files when file >2GB #388

Closed
RandolfCarter opened this issue Nov 13, 2012 · 14 comments
Closed

Negative file sizes in cached files when file >2GB #388

RandolfCarter opened this issue Nov 13, 2012 · 14 comments
Assignees

Comments

@RandolfCarter
Copy link
Contributor

As reported in the forum ( http://forum.owncloud.org/viewtopic.php?f=4&t=5053 ):

A bug in the cached files in the mysql. A File with more than 2 GB on a 32bit System will have a negative size. The MySQL table is set to bigint which is correct. I took a look at the source there you are working with int vars which is not recommended on 32bit Systems for big numbers!!! Please use float here. This breaks the folder size, file size and the quota.

If possible, questions should be asked in the forum.

@DeepDiver1975
Copy link
Member

@icewind1991 Can you please have a look? THX

@icewind1991
Copy link
Contributor

I've managed to reproduce on a 32 bit test system but I can't figure out the cause

@icewind1991
Copy link
Contributor

Run a filesystem scan over a folder with more then 2 GB of data, by emptying the fscache table and running scanfiles(true) in the JavaScript console

@DeepDiver1975
Copy link
Member

The original report is right on his statement about the signed 32-bit integer:
http://php.net/manual/en/function.stat.php - see the note in there.

this signed 32-bit integer is used as type for the calculated result - this should be easy to change

In addition we need to find a solution to get the size of files bigger than 2GB - @icewind1991 any solution on your mind?

@DeepDiver1975
Copy link
Member

I cannot reproduce this on my 32-bit system.
I'd try the following:
1.) cast the return to float in https://github.com/owncloud/core/blob/master/lib/filecache.php#L440
2.) (really needed?) initialize $totalSize with a float zero in https://github.com/owncloud/core/blob/master/lib/filecache.php#L385

@icewind1991 What do you think?

@karlitschek
Copy link
Contributor

ping

@karlitschek
Copy link
Contributor

A PHP int should automatically be converted to a float on overflow. Maybe this is DB related? @RandolfCarter @icewind1991 @DeepDiver1975 Which exact DB types and versions do you use?

@RandolfCarter
Copy link
Contributor Author

It was not me who had that problem, it came up in the forum, I'll try to relay the question.

@RandolfCarter
Copy link
Contributor Author

$ mysql --version
mysql Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (i686) using readline 6.2

@nstephens
Copy link

I too am seeing this problem on a 32 bit system. CentOS DVD was uploaded as a test (4.0gb) and reports -5580800 B in owncloud. Obviously I had to use the sync application to get this one uploaded. It was done using the xubuntu linux client.

debian 6.0.4

Linux boxname 2.6.32-5-686 #1 SMP Mon Mar 26 05:20:33 UTC 2012 i686 GNU/Linux

mysql Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (i486) using readline 6.1

Server version: Apache/2.2.16 (Debian)

PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 20:08:59)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

@ghost ghost assigned DeepDiver1975 Jan 2, 2013
@DeepDiver1975
Copy link
Member

I could reproduce this one - finally.
On a 32bit system stat cannot handle files bigger than 2GB - see my comment above #388 (comment)

Possible solution:
http://www.phpclasses.org/browse/file/32900.html
http://stackoverflow.com/questions/6482211/php-filesize-over-4gb

I'll go for that:
http://php.net/manual/de/function.filesize.php#80959

@DeepDiver1975
Copy link
Member

this is fixed for OC5
@karlitschek shall we backport this? 'Only' 32bit systems are affected

@karlitschek
Copy link
Contributor

@DeepDiver1975 Yes. Would be great

@DeepDiver1975
Copy link
Member

will be shipped with 4.5.7

@lock lock bot locked as resolved and limited conversation to collaborators Aug 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants