[Tickets #2315] NEW: Uploading attachment uses too much memory

bugs@bugs.horde.org bugs at bugs.horde.org
Thu Jul 21 07:20:07 PDT 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=2315
-----------------------------------------------------------------------
 Ticket             | 2315
 Created By         | nomis80 at lqt.ca
 Summary            | Uploading attachment uses too much memory
 Queue              | IMP
 Version            | 4.0.3
 State              | Unconfirmed
 Priority           | 2. Medium
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


nomis80 at lqt.ca (2005-07-21 07:20) wrote:

I wanted to permit 10MB attachments so I changed these values in php.ini:

upload_max_filesize = 10M
memory_limit = 40M
post_max_size = 11M

I figured that since memory_limit was 8M when upload_max_filesize was 2M
(default values on RHEL 4), I should scale memory_limit by the same factor
as upload_max_filesize to be sure that it would work. I use a post_max_size
one meg bigger than upload_max_filesize to allow for HTTP and encoding
overhead.

I also increased the max_packet_size of MySQL 4.1.10a to 11M, one meg more
to allow for packet overhead.

I generated an attachment file of exactly 10MB using this command:

$ dd if=/dev/zero of=attach bs=$((1024*1024*10)) count=1
$ ls -l attach
-rw-rw-r--  1 nomis80 nomis80 10485760 Jul 21 09:54 attach

When I uploaded the file the first time, I hit the memory_limit according to
this error message:

[client 10.10.1.153] PHP Fatal error:  Allowed memory size of 41943040 bytes
exhausted (tried to allocate 20971522 bytes) in
/usr/share/pear/DB/common.php on line 356, referer:
http://10.10.1.202/webmail/imp/compose.php?uniq=1121955430742
Allowed memory size of 41943040 bytes exhausted (tried to allocate 0 bytes)

I proceeded to increase the memory_limit by a factor of two every time I
received that error. Soon, I was at 320M, and this was causing my server to
trash while writing to disk swap memory. I could not figure out exactly at
which value I had to set memory_limit for the system to accept my
attachment.




More information about the bugs mailing list