Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Out of memory upload error  (Read 16476 times)

0 Members and 1 Guest are viewing this topic.

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Out of memory upload error
« on: May 24, 2010, 11:57:54 am »

It seems like I am not able to upload files bigger than 1 MB

PHP is set to 20 MB max file size and post_max_size to 8 MB an CPG is set to 6 MB

Fatal error: Out of memory (allocated 30408704) (tried to allocate 9216 bytes) in /homepages/4/d260051897/htdocs/stjarna/cpg/include/picmgmt.inc.php on line 429

I get this error shown in attachment. 
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #1 on: May 24, 2010, 12:05:10 pm »

Test account

Username: Barabenz   
Password: barajonk
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #2 on: May 24, 2010, 12:07:23 pm »

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Out of memory upload error
« Reply #3 on: May 24, 2010, 05:14:15 pm »

http://stjarna.nutima.net/cpg/docs/en/upload_troubleshooting.htm#ErrorAllowedMemorySize

Issues might be related to your custom modifications, so please post about them.
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #4 on: May 24, 2010, 11:58:36 pm »

Well, I think I have tried  everything.

Restored to default settings.

Here is PHP info

1. max_input_time -1 -1

2. upload_max_filesize 20M 20M

3. post_max_size 8M 8M

4. memory_limit 40M 40M

5. LimitRequestBody no parameter

6. file_uploads On On

7. upload_tmp_dir no value no value

Maybe this is a server problem, but I would think that I should be able to upload at least to 2 MB

I can not even upload this photo and it is only 191 kb.  See properties in first atthachment and photo in second.

I can PM you the admin user and password if you would like.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Out of memory upload error
« Reply #5 on: May 25, 2010, 12:08:36 am »

As asked above, what are your custom modifications?

Have you tried with a fresh, clean install of coppermine to rule out everything you have changed?
Logged
It is a mistake to think you can solve any major problems just with potatoes.

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #6 on: May 25, 2010, 12:12:12 am »

It was not a fresh install but I used this here  http://stjarna.nutima.net/cpg/admin.php?restore
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #7 on: May 25, 2010, 12:14:36 am »

And I tried with only curve theme and english.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Out of memory upload error
« Reply #8 on: May 25, 2010, 08:11:37 am »

It was not a fresh install but I used this here  http://stjarna.nutima.net/cpg/admin.php?restore
That was silly and uncalled for, as suggested in http://documentation.coppermine-gallery.net/en/configuration.htm#admin_reset_entire_config

Well, I think I have tried  everything.
  • You're using a custom bridge file that we're not aware off, although I told you to report your changes.
  • When using the flash-driven upload I get the error message I have attached as a screenshot, which shows that you have performed an edit
  • Single file uploads using the HTML-driven form work as expected, see http://stjarna.nutima.net/cpg/displayimage.php?pid=162

Maybe this is a server problem, but I would think that I should be able to upload at least to 2 MB
I can not even upload this photo and it is only 191 kb.  See properties in first atthachment and photo in second.
You haven't read the section of the docs I have refered to, have you? Let me quote it for you once more, highlighting the important bits:
Error message: Fatal error: Allowed memory size of XXXXXXX bytes exhausted at (null):0 (tried to allocate XXXX bytes) in /var/www/html/include/picmgmt.inc.php
Possible cause: This error occurs when using GD and attempting to upload a high resoltuion image. It's not the size of the file that matters here; it's the number of pixels that determine memory use in GD. This is not a soft error triggered by Coppermine, but a hard error from PHP that shines through Coppermine from PHP.
Suggested fix:There is (at least in theory) no limit in Coppermine to the file size or dimensions that the script can handle. However, there is at least one limit existing on the webserver: resizing images (to create intermediate images and/or thumbnails) consumes memory and burns CPU cylces. To prevent the server from crashing, the server admin has to restrict the amount of memory that a PHP script is allowed to consume. The error message mentioned above means that the limit imposed by the server admin has been reached, i.e. the image that the script tried to process consumed to much memory.
  • Alternative 1 (ideal): Increase the memory limit allocation in php.ini as suggested in Memory usage during resizing. If you cannot change php.ini, you should read alternatives 2 and 3.
  • Alternative 2 (sensible): Resize your images before uploading if you do not require high resolution images. This saves upload bandwidth and time for you.
  • Alternative 3 (workaround): You may download one of many free programs that resize images. Then resize the images to a smaller resolution (like 800 x 600) by the batch into a different folder while maintaining the same filenames. Upload the resized images to Coppermine. Then use your FTP client to overwrite the images with the higher resolution images.
Memory usage during resizing
There is (at least in theory) no limit in Coppermine to the file size or dimensions that the script can handle. However, there is at least one limit existing on the webserver: resizing images (to create intermediate images and/or thumbnails) consumes memory and burns CPU cylces.

If the resizing process is eating up too much memory, you usually get the error message Fatal error: Allowed memory size of XXXXXXX bytes exhausted at (null):0 (tried to allocate XXXX bytes) in /var/www/html/include/picmgmt.inc.php or similar.

To prevent the server from crashing, the server admin has to restrict the amount of memory that a PHP script is allowed to consume. This is done using the parameter memory_limit.

You might be tempted to believe that the memory usage equals the file size an image consumes on file system level, but that's not the case: the common file format JPEG is compressed, so if the server loads a JPEG file into memory, it consumes much more RAM than it consumed on file system level.

To calculate the amount of memory an image uses, you simply multiply the pixel width and height, and then you multiply the result by the number of base colors (RGB - 3, CMYK - 4). Finally, you divide by 1,048,576 (220) to get the memory usage in MB.

Here are some common image resolutions and their memory use in GD (assuming RGB):
Width       Height    Memory usage
800    x    600    1.4 MB
1024    x    768    2.3 MB
1280    x    800    2.9 MB
1280    x    1024    3.8 MB
1400    x    1050    4.2 MB
1600    x    1200    5.5 MB
1920    x    1400    7.7 MB
2048    x    1536    9.0 MB
2560    x    1600    11.7 MB
2800    x    2100    16.8 MB
3200    x    2400    22.0 MB
4096    x    3072    36.0 MB
6400    x    4800    87.9 MB


Remember when using the above figures that the amount of memory being used by the rest of Coppermine must be taken into account, too.

As you can see, the memory consumption of images produced by modern digital cameras can easily be too much for your webserver to cope with, even when using single file uploads (let alone the consumption when processing several images using batch-add), so it's recommended to resize your images on your client before uploading them: if the server simply isn't capable to process the images uploaded, there's little point in blaming the script (i.e. Coppermine) or asking for support on the Coppermine support board: the Coppermine devs can not find a cure for the technology used on webservers. Use the webserver for what it has been designed to be used for; perform resources-intensive calculations (like resizing images with a high resolution) on your client.

To increase the memory limit allocation in php.ini, you must be the server's administrator. Also, .htaccess files cannot change this configuration setting, and it cannot be changed using ini_set(). This being said, most coppermine users who are on shared webhosting will not be able to change this. If you actually are the server admin, here's how to increase the memory limit:
First, you locate the following block in php.ini (if you actually are the server admin):

Code: [Select]
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60        ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)

Now you increase the memory limit to fit your needs. 9 to 16 MB should handle most requirements.

If you are unable to change php.ini settings yourself, you can always ask your server administrator to change this for you. However, most administrators (especially on shared webhosting) will be reluctant to do so, as this setting will affect everyone on a shared server. A higher memory limit requires reducing the number of people who can be hosted on the same server in order to maintain server stability. This reduces profitability, etc.

Do not ask questions on the Coppermine support board how to configure your webserver; it's beyond the scope of the Coppermine support board to explain webserver setups. Usually (if you're on shared webhosting, which is the case for the vast majority of Coppermine users), you can't change webserver settings anyway. Only the person who actually administers the webserver (i.e. the webhost's admin) can change webserver settings.
Therefore, you better ask your webhost for support if you have issues with ressource limitations or other questions that related to webserver setup. If you're self-hosted (which is something the coppermine dev team doesn't recommend), you should read up your issue in the documentation that comes with your webserver.

Your reply where you talk about file size on file system level shows that you haven't understood what we're trying to say. The dimensions of your test file "house.jpg" are 1787 x 1181, which is quite a lot. It doesn't matter that the file size is small, as that's the compressed space usage on file system level only. Taking into account the formula given above, your test file needs more than 6 MB of RAM. which doesn't make it an actually valid test file. Images with a resolution larger than the average screen resolution are not fit for usage on the web.

And I tried with only curve theme and english.
The error message that shows through using flash upload indicates that you have fiddled with a core file...

I can PM you the admin user and password if you would like.
No, you can't: we have deliberately disabled that feature. We don't need it.
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #9 on: May 25, 2010, 09:32:03 am »

Sorry if there is some misunderstanding.  But why is it silly to restore?

Well, read everything and tried everything.  Except I forgot to disable (undo) the bridge. That is the only customasation I have done and then another theme (lgames).  Well, another language also.

My memory limit is 40M so I thought it was okay if it went a little above 6M (6,03MB)  Should be able to handle more.  Is it possible that Coppermine is not releasing memory or doing too much at the same time.

The error message you attach comes only in Firefox.  There is a different message in IE8 (see attachment)  It would be nice if Coppermine would advice that it is too high resolution instead of reporting upload failed.  Just like it reports size limits (MB) and that it is too big in MB.

I will just find a way to inform the users what they have to beware of (resolution limits).

Thanks for your attention and Coppermine is still the best.

Best regards,  Jon

Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Out of memory upload error
« Reply #10 on: May 25, 2010, 11:34:00 am »

It could still be one of your mods as suggested.

Try making a plain install of coppermine somewhere else on your server. It will only take you 10 minutes to prove whether it is your modifications or not.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Out of memory upload error
« Reply #11 on: May 25, 2010, 04:33:23 pm »

It would be nice if Coppermine would advice that it is too high resolution instead of reporting upload failed. 
How could it possibly do that? The webserver underneath Coppermine crashes, so how could Coppermine detect that before it happens, stop the crash and tell the client about it? Coppermine is not aware of the dimensions of the file untill it starts processing the file. Once the processing has started, the webserver's mechanisms and limitations apply. To give you an analogy from another field: you could request from a car manufacturer to create a car that warns you one second before the airbag fires in case of a crash. How should the car's sensors know that an accident will be happening in the future? Mission impossible. Every car manufacturer will tell you that such a device possibly can't be created.

Sorry if there is some misunderstanding.  But why is it silly to restore?
Don't fix stuff that ain't broken; the error message you get comes from the webserver underneath coppermine's core, so what good should a reset of Coppermine's config do in this aspect?

Except I forgot to disable (undo) the bridge. That is the only customasation I have done and then another theme (lgames).  Well, another language also.
That's three different factors that can have a massive impact on the performance of the script.

My memory limit is 40M so I thought it was okay if it went a little above 6M (6,03MB)  Should be able to handle more.  Is it possible that Coppermine is not releasing memory or doing too much at the same time.
Not during regular http upload, no.
Logged

jonket

  • Translator
  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 64
Re: Out of memory upload error
« Reply #12 on: May 25, 2010, 05:38:47 pm »

1.  What I mean is that Coppermine tells you that a file can not be more than 1 MB f.ex.  Maybe it could also advise in text in upload page before starting process that resolution (set value) can not be more than aaaa x bbbb.  Just to try to avoid upload failure.

2.  Well,  I was advised to clean install to clear customisation. My simple mind thought that ?restore would do that.

3.  Thats why I disabled language and theme.  Just forgot Joomla bridge.

4.  Then I know about this memory problem.  Other programs in Joomla, like (Phocagallery) seem to be able to handle full size and resize it.  So I did not expect a problem with Coppermine.

I made a clean install as advised, tried it with no bridge, default language, default theme.  Now the upload works much better (house.jpg uploaded). Still have to test it more, see how far I can go.
So it is a bridge or a Joomla user problem.

I am sorry for all the trouble.

Best regards and thanks for the patience,  Jon

Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Out of memory upload error
« Reply #13 on: May 25, 2010, 07:09:22 pm »

It could be the language file, the bridge or the theme as Joachim suggests. Apply them one at a time until you can determine which one is causing the problem. Start with the lang file, then the theme and finally the bridge. Test at each stage. If it is the bridge you'll have to ask its author for assistance.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Out of memory upload error
« Reply #14 on: May 25, 2010, 08:39:25 pm »

FYI: If we talk about 'customizations', we mean code customizations, not config options. Sorry if that wasn't clear.
Logged
Pages: [1]   Go Up
 

Page created in 0.039 seconds with 19 queries.