Owncloud : could not calculate folder size
Par Mathieu le jeudi 17 mai 2012, 21:53 - Hacks - Lien permanent
I recently installed Owncloud, and I already had some problems in order to make it run.
I finally managed to make it run, but I ran into an other problem today.
I tried to upload (with SSH, not with the web interface) my music collection that is bigger than 2Go, and I got the following error :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[22003]: Numeric value out of range: 7 ERREUR: la valeur « 2857678756 » est en dehors des limites du type integer' in /home/.../public_html/lib/db.php:527 Stack trace: #0 /home/.../public_html/lib/db.php(527): PDOStatement->execute(Array) #1 /home/.../public_html/lib/filestorage/local.php(326): PDOStatementWrapper->execute(Array) #2 /home/.../public_html/lib/filestorage/local.php(295): OC_Filestorage_Local->calculateFolderSize('mathieu/files/M...') #3 /home/.../public_html/lib/filestorage/local.php(47): OC_Filestorage_Local->getFolderSize('mathieu/files/M...') #4 /home/.../public_html/lib/filesystem.php(573): OC_Filestorage_Local->filesize('mathieu/files/M...') #5 /home/.../public_html/lib/filesystem.php(346): OC_Filesystem::basicOperation('filesize', '/Musique') #6 /home/.../public_html/lib/files.php(54): OC_Filesystem::filesize('/Musique') #7 /home/.../public_html/files/index.php(48): OC in /home/.../public_html/lib/db.php on line 527
It seemed that the Owncloud developers haven’t thought about the weird guy who had more than 2Go of Music. I changed the size of the column from integer to bigint in the PostgreSQL database (I had configured Owncloud with PostgreSQL), and the problem vanished :
ALTER TABLE foldersize ALTER size TYPE bigint ;
I hope it will help those who are stuck with this problem. I will also check if the problem is a known bug, and if it is not, I will declare it in the Owncloud bug tracker.
Thinking about it, maybe the “reasonnable” solution would be to change the value to an “unsigned int”, but it will limit the folders size to 4Go, and the problem could appear again.
EDIT : it is a known and fixed bug (in next version) : http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-296