Piwigo Bugtracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000949Piwigoweb APIpublic2009.03.15 21:362009.04.15 00:54
Assigned Toplg 
PlatformOSOS Version
Product Version2.0.0 
Target Version2.0.2Fixed in Version2.0.2 
Summary0000949: [pwg.images.add] heavy photo upload fails when bigger than memory limit
DescriptionCurrent algorithm (for 2.0.1, see bug:941) chunks file for upload and then merge it back before base64_decode.

The problem is that if your photo weights 8MB, it becomes a 10.5MB base64 string. the merge_chunks function loads 10.5MB in memory as a string. Then base64_decode created another 8MB string => you have 18.5MB in memory (without taking into account the basic memory usage). Standard memory limit is set to 16MB, so the upload fails BUT pwg.images.add returns code 200 (ie "OK").
Additional InformationIt seems that an algorithm based on reading chunks with a length multiple of 4 should make the partial base64_decode possible, it would solve the problem :-) Unfortunately, I haven't been able to make it work yet.
TagsNo tags attached.
Database engine and version
PHP version
Web serverApache 1.3.x
Attached Files

- Relationships
related to 0000966closedrosman pLoader encode chunks one by one 

-  Notes
plg (manager)
2009.04.08 00:15
edited on: 2009.04.15 00:33

A solution is to base64 encode chunks one by one, so that pwg.images.addChunk can base64 decode a small amount of data at a time, no memory problem anymore. raw chunks can then be appended into the final file without loading the full file in memory.

plg (manager)
2009.04.15 00:54

fixed on branch 2.0 in [Subversion] r3239
merged on trunk in [Subversion] r3240

- Issue History
Date Modified Username Field Change
2009.03.15 21:36 plg New Issue
2009.03.15 21:36 plg Status new => assigned
2009.03.15 21:36 plg Assigned To => plg
2009.03.15 21:36 plg browser => any
2009.03.15 21:36 plg Web server => Apache 1.3.x
2009.04.08 00:15 plg Note Added: 0002571
2009.04.08 00:15 plg Target Version => 2.0.2
2009.04.08 00:17 plg Relationship added related to 0000966
2009.04.15 00:33 plg Note Edited: 0002571
2009.04.15 00:54 plg Note Added: 0002575
2009.04.15 00:54 plg Status assigned => closed
2009.04.15 00:54 plg Resolution open => fixed
2009.04.15 00:54 plg Fixed in Version => 2.0.2

Copyright © 2000 - 2015 MantisBT Team
Powered by Mantis Bugtracker