View Issue Details

This bug affects 1 person(s).
 18
IDProjectCategoryView StatusLast Update
04787Bug reportsConditionspublic2011-04-11 13:33
Reporteruser11009Assigned Tomdekker  
PriorityurgentSeverityminor 
Status closedResolutionfixed 
Product Version1.90+ 
Fixed in Version1.91RC6 
Summary04787: Bug in getArrayFilterExcludesCascadesForGroup() function causing querying for too many questions
Description

I have a survey (group by group mode) in which at some point function getArrayFilterExcludesCascadesForGroup is executing getQuestionAttributes function for EVERY question in whole survey.

I understand, that getQuestionAttributes function should be called only for questions in current group. Because I have an very important survey, in which there is about ~700 rows in questions table, making 700 queries per request costs a lot.

Steps To Reproduce

I can't attach the survey, but I'll try to reproduce/trace this problem on a smaller example later.

Additional Information

A little backtrace put in getQuestionAttributes function body:

#0 getQuestionAttributes(14369) called at [/var/www/l/common.php:4676]
#1 getArrayFilterExcludesCascadesForGroup(83647, , title) called at [/var/www/l/common.php:4887]
#2 getArrayFilterExcludesForQuestion(10598) called at [/var/www/l/index.php:1400]
#3 checkconfield(83647X1136X105981) called at [/var/www/l/save.php:407]
#4 createinsertquery() called at [/var/www/l/save.php:125]
#5 require_once(/var/www/l/save.php) called at [/var/www/l/index.php:7

TagsNo tags attached.
Bug heat18
Complete LimeSurvey version number (& build)9561
I will donate to the project if issue is resolvedYes
Browser
Database type & versionmysql
Server OS (if known)debian lenny
Webserver software & version (if known)Apache/2.2.9
PHP Version5.3.3

Relationships

related to 05068 closedTMSWhite Performance issue with long surveys and conditions 

Users monitoring this issue

There are no users monitoring this issue.

Activities

user11009

2010-12-04 00:42

  ~13681

I checked a different survey, and the problem exists also there - in few first groups everything is ok, and at some point that function starts querying for every question in whole survey.

user11009

2010-12-04 02:19

  ~13688

Carsten passed me this solution - changing
getQuestionAttributes($qrow['qid']);
to
getQuestionAttributes($qrow['qid'], $qrow['type']);
in getArrayFilterExcludesCascadesForGroup function, thanks! :)

user11009

2010-12-04 02:48

  ~13689

Verry weird thing... after passing question type, as Carsten suggested, and saving few hundreds of queries, the script execution time takes much longer.
I'll try to investigate it tomorrow.

Mazi

Mazi

2011-01-31 16:49

updater   ~14019

Any new findings on this?

jcleeland

jcleeland

2011-02-18 00:33

reporter   ~14247

I'd like to figure this bug out - is there any chance you could build a survey that you can share, so I can try it?

user12982

2011-03-24 22:07

  ~14533

I've got a file here that replicates the problem:

http://benian.nl/MISC/limesurvey_bug_4787.lss

Steps to reproduce:

  • Import survey file
  • Make survey active
  • Start new participation in active survey
  • Check some boxes in the first question
  • Enter the answers on the second question
  • After submitting the second question it should load extremely slowly ( > 30 seconds) or time-out

(I've tried on my own server and limeservice.com, same problem)

user11009

2011-03-25 01:46

  ~14535

Hey, sorry for not responding. I found that the problem lays somwhere in checkconfield function. Setting "deletenonvalues" to 0 helps, but ofcourse it's not the solution :)

The problem happens in various longer surveys. It looks like in some point of that surveys "checkconfield" function starts to produce a huge number of queries.

I can provide some other surveys if wanted.

user12982

2011-03-25 05:36

  ~14536

As suggested in http://bugs.limesurvey.org/view.php?id=4787#c13688 tried changing in getArrayFilterExcludesCascadesForGroup function:

  • getQuestionAttributes($qrow['qid'], $qrow['type']); // Very slow, roughly a minute
  • getQuestionAttributes($qrow['qid']); // Slow, roughly 10 seconds
mdekker

mdekker

2011-04-05 13:27

reporter   ~14671

Think I solved the problem by adding a little memory to functions that are called often: getArrayFiltersForQuestion and getArrayFilterExcludesForQUestion

mdekker

mdekker

2011-04-05 13:34

reporter   ~14672

Fixed in svn 9964 by adding cache to some frequently called functions, please reopen if this does not fix the problem

c_schmitz

c_schmitz

2011-04-05 13:51

administrator   ~14675

Please don't forget to commit this to _dev branch, too.

mdekker

mdekker

2011-04-05 16:37

reporter   ~14677

done in 9967

Issue History

Date Modified Username Field Change
2010-12-04 00:35 user11009 New Issue
2010-12-04 00:35 user11009 Status new => assigned
2010-12-04 00:35 user11009 Assigned To => lemeur
2010-12-04 00:42 user11009 Note Added: 13681
2010-12-04 02:19 user11009 Note Added: 13688
2010-12-04 02:48 user11009 Note Added: 13689
2010-12-04 12:05 user11009 Issue Monitored: user11009
2010-12-09 23:51 c_schmitz Assigned To lemeur => jcleeland
2011-01-31 16:49 Mazi Note Added: 14019
2011-01-31 16:49 Mazi Status assigned => feedback
2011-02-18 00:33 jcleeland Note Added: 14247
2011-03-24 22:07 user12982 Note Added: 14533
2011-03-25 01:46 user11009 Note Added: 14535
2011-03-25 01:46 user11009 Status feedback => assigned
2011-03-25 05:36 user12982 Note Added: 14536
2011-04-05 09:11 mdekker Relationship added related to 05068
2011-04-05 13:27 mdekker Note Added: 14671
2011-04-05 13:31 mdekker Assigned To jcleeland => mdekker
2011-04-05 13:34 mdekker Note Added: 14672
2011-04-05 13:34 mdekker Status assigned => resolved
2011-04-05 13:34 mdekker Fixed in Version => 1.91RC5
2011-04-05 13:34 mdekker Resolution open => fixed
2011-04-05 13:51 c_schmitz Note Added: 14675
2011-04-05 16:37 mdekker Note Added: 14677
2011-04-11 13:33 c_schmitz Status resolved => closed
2011-04-11 13:33 c_schmitz Fixed in Version 1.91RC5 => 1.91RC6