There is a weird bug (that was essentially causing a large memory leak when generating big CSV files) in the webform_get_submission() function.

For some reason the $submissions = array(); at the start of the webform_get_submission method was setting the $submissions variable as static. This was meaning when there is a LARGE csv to be exported, the memory usage grows massively. It's essentially a memory leak.

Applicaiton memory is not the best place to put this sort of stuff in our experience.

The code probably needs to be refactored slightly (removed $reset) ... however this fixes the memory leak.

CommentFileSizeAuthor
webform_submissions.inc_.patch626 bytesAndrewBoag

Comments

AndrewBoag’s picture

Priority: Critical » Normal

In retrospect, this probably isn't a critical bug and I understand that you are trying to not pound the database with requests for the same submission. However, with large numbers of submissions this will cause issues.

quicksketch’s picture

Category: bug » support
Status: Active » Fixed

I probably won't be changing the behavior of the 2.x version at all at this point. 3.x still uses the same code and I don't think it's likely that you'd load more than a single submission in a request. Individual submissions are not actually loaded when downloading CSVs, they use webform_get_submissions() which does not include a static cache for the reasons you describe. So in short, if you load a single submission, the submission is cached, but if you load multiple, they are not.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.