[Owncloud] Problems when sharing large files

Christian Schneider mail at chrschn.de
Tue Mar 13 14:22:01 UTC 2012


Hi all.

Using ownCloud 3.0, I experienced problems when trying to share large
files globally. The Web server just returned a 500, the Apache log
revealed the underlying problem:

[Tue Mar 13 14:29:00 2012] [error] [client ...] PHP Fatal error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate
381095937 bytes) in /var/www/owncloud-3.0.0/lib/filestorage/local.php on
line 62

It turns out that this is a common problem witn PHP's readfile()
function, and the best way to handle it is to read the file in chunks.
So I patched the local.php file, see attached. This approach works fine
for me with small files (< $chunksize) and large files
(380 MB). Maybe you might consider merging this into the master branch.

Doing a quick grep through the source code, it seems that there exists
the exact same problem in lib/filestorage/remote.php, but I don't know
how and when the OC_Filestorage_Remote class is used and if it might
ever happen that the remote file size will exceed the memory limit.

-Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: owncloud-3.0-large_files_sharing.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20120313/683b5edc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20120313/683b5edc/attachment.sig>


More information about the Owncloud mailing list