Piwigo Bugtracker

Viewing Issue Advanced Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000949 [Piwigo] web API major always 2009.03.15 21:36 2009.04.15 00:54
Reporter plg View Status public  
Assigned To plg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 2.0.2 Product Version 2.0.0
  Target Version 2.0.2 Product Build
Summary 0000949: [pwg.images.add] heavy photo upload fails when bigger than memory limit
Description Current 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").
Steps To Reproduce
Additional Information It 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.
Tags No tags attached.
browser any
Database engine and version
PHP version
Web server Apache 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

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker