View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
07995Bug reportsOtherpublic2013-08-04 21:54
Reporterlitotes Assigned ToDenisChenu  
PriorityhighSeverityblock 
Status closedResolutionfixed 
Product Version2.00+ 
Fixed in Version2.00+ 
Summary07995: Survey Activation Causes PHP Out-of-Memory
Description

In activate_helper.php, the function checkQuestions() has the following:

//1: Get each condition's question id
$conquery= "SELECT {{conditions}}.qid, cqid, {{questions}}.question, "
. "{{questions}}.gid "
. "FROM {{conditions}}, {{questions}}, {{groups}} "
. "WHERE {{conditions}}.qid={{questions}}.qid "
. "AND {{questions}}.gid={{groups}}.gid ORDER BY {{conditions}}.qid";

This query is returning results from ALL surveys, whereas, surely, it only needs to return results from the survey being activated, thus:

//1: Get each condition's question id
$conquery= "SELECT {{conditions}}.qid, cqid, {{questions}}.question, "
. "{{questions}}.gid "
. "FROM {{conditions}}, {{questions}}, {{groups}} "
. "WHERE {{conditions}}.qid={{questions}}.qid "
. "AND {{questions}}.gid={{groups}}.gid AND {{questions}}.sid={$iSurveyID} ORDER BY {{conditions}}.qid";
Steps To Reproduce

Activate any survey. To fail (with a PHP out-of-memory error), you need to have sufficient existing surveys of sufficient complexity to cause the result set from the above query to exceed the PHP memory limit, as configured in the ""php.ini" file.

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)130708
I will donate to the project if issue is resolvedNo
BrowserAny
Database type & versionmysql 5
Server OS (if known)OS X 10.8
Webserver software & version (if known)Apache 2
PHP VersionPHP 5.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2013-07-11 08:47

developer   ~25755

Hello,

We already have {{conditions}}.qid={{questions}}.qid then set sid don't filter anything (because qid => gid => sid).

Can you upload a lss example file and tell us how many memory PHO can have ?

litotes

litotes

2013-07-11 19:57

reporter   ~25757

Hi,

I don't fully understand your comment that the "sid" filter won't do anything as: qid => gid => sid

The original query gets data from {{conditions}}, {{questions}}, {{groups}}
but the "where" clauses only join on "qid" and "gid", so you are going to get questions and groups across all surveys, without the further "sid" restriction.

Please try activating a survey in the LS2 DB that has 2 surveys, and see that the original query fetches data from both surveys, even though we are only activating one.

I can provide example LSS files, but this issue occurs regardless of their contents.

In my case, I had memory limit of 512M, but needed to increase it to 2048M to activate a new survey (of only 4 questions!) due to this query returning 1.3M rows :-)

Thanks,

Chris

DenisChenu

DenisChenu

2013-07-11 20:14

developer   ~25758

Last edited: 2013-07-11 20:16

Oh !!!!

You're totaly right !

Beter reading, have to sleep ....

Argl !

fixnumbering too .... all are to be updated !

DenisChenu

DenisChenu

2013-07-11 20:57

developer   ~25759

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=12717

DenisChenu

DenisChenu

2013-07-11 21:04

developer   ~25760

Fix committed to 2.05 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=12719

c_schmitz

c_schmitz

2013-08-04 21:54

administrator   ~25922

2.00+ Build 130802 released

Related Changesets

LimeSurvey: master 8da619af

2013-07-11 18:52:52

DenisChenu

Details Diff
Fixed issue 07995: Memory issue in Survey Activation
Dev: fixnumbering need to be review
Dev: All SQL need reviewing (put this for 2.05)
Affected Issues
07995
mod - application/helpers/admin/activate_helper.php Diff File
mod - application/models/Questions.php Diff File

LimeSurvey: 2.05 b160034c

2013-07-11 19:00:18

DenisChenu

Details Diff
Fixed issue 07995: Memory issue in Survey Activation
Dev: fixnumbering need to be review
Dev: All SQL need reviewing (put this for 2.05)
Affected Issues
07995
mod - application/helpers/admin/activate_helper.php Diff File
mod - application/models/Question.php Diff File

Issue History

Date Modified Username Field Change
2013-07-11 01:02 litotes New Issue
2013-07-11 08:47 DenisChenu Note Added: 25755
2013-07-11 19:57 litotes Note Added: 25757
2013-07-11 20:14 DenisChenu Note Added: 25758
2013-07-11 20:14 DenisChenu Assigned To => DenisChenu
2013-07-11 20:14 DenisChenu Status new => assigned
2013-07-11 20:16 DenisChenu Note Edited: 25758
2013-07-11 20:57 DenisChenu Changeset attached => LimeSurvey master 8da619af
2013-07-11 20:57 DenisChenu Note Added: 25759
2013-07-11 20:57 DenisChenu Resolution open => fixed
2013-07-11 21:04 DenisChenu Changeset attached => LimeSurvey 2.05 b160034c
2013-07-11 21:04 DenisChenu Note Added: 25760
2013-07-11 21:31 DenisChenu Status assigned => resolved
2013-07-11 21:31 DenisChenu Fixed in Version => 2.00+
2013-08-04 21:54 c_schmitz Note Added: 25922
2013-08-04 21:54 c_schmitz Status resolved => closed