View Issue Details

IDProjectCategoryView StatusLast Update
16483Bug reportsConditionspublic2020-08-18 21:44
Reporterjenseeckhout Assigned Togabrieljenik  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version4.2.5 
Summary16483: Adding condition triggers bulk update for complete database
Description

When adding a condition to a question (no matter which type, values or scenario), the complete database is processed, instead of just processing the survey you were working in.
See https://github.com/LimeSurvey/LimeSurvey/blob/master/application/controllers/admin/conditionsaction.php#L767

NULL is passed as a first argument instead of the active survey ID to LimeExpressionManager::UpgradeConditionsToRelevance(null, $qid);
That function reads as follows: * @param integer|null $surveyId - if NULL, processes the entire database, otherwise just the specified survey

This makes it so that every time a condition is added, the complete database is processed. In the case of my client, this is a very large database with many surveys, questions and conditions. This then results in either PHP running out of memory, or the server timing out and throwing an error.

Steps To Reproduce
  1. Have several surveys on a Limesurvey instance, each containing some questions with conditions on them.
  2. Go to one survey and add a condition (does not matter which parameters) to a question.
  3. Observe (the way I monitored is: enable MySQL logging in my.cnf and tail -f query.log in terminal) how every survey is processed
  4. (in my case) Wait for over 2min for the server to either time out, or PHP to run out of memory.
Additional Information

Do note that the condition actually gets added correctly. It is the next action (LimeExpressionManager::UpgradeConditionsToRelevance) that causes the timeout/crash.

Tagsconditions
Complete LimeSurvey version number (& build)4.2.5
I will donate to the project if issue is resolvedNo
Browser
Database & DB-VersionMySQL 10.3.22 (MariaDB)
Server OS (if known)Ubuntu 20.04 LTS
Webserver software & version (if known)Apache/2.4.41 (Ubuntu)
PHP Version7.2

Relationships

related to 16604 assignedgabrieljenik Adding condition triggers bulk update for complete database 

Activities

gLf

gLf

2020-07-29 16:20

reporter   ~59158

Same behaviour on 4.2.2+200504
condition/scenario is set, but with timeout/crash

gabrieljenik

gabrieljenik

2020-08-05 00:45

developer   ~59313

Last edited: 2020-08-14 11:03

I think this happens on LS3 as well.

gabrieljenik

gabrieljenik

2020-08-10 18:12

developer   ~59395

Last edited: 2020-08-14 11:03

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1542

Function updated to get the survey ID from the question if surveyId is null and a qid is specified.
UpgradeConditionsToRelevance receives two params: surveyId and qid. If the qid is specified, it should only update that question (as per the function doc). But, if surveyId is null, it loops trough all the surveys, which only makes sense if no qid is specified.

gabrieljenik

gabrieljenik

2020-08-13 14:09

developer   ~59457

Last edited: 2020-08-14 11:03

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

ollehar

ollehar

2020-08-13 14:09

administrator   ~59458

Last edited: 2020-08-14 11:03

Is same fix made for LS3?

lime_release_bot

lime_release_bot

2020-08-17 14:05

administrator   ~59472

Fixed in Release 4.3.11+200817

Related Changesets

LimeSurvey: master 3dbba5b8

2020-08-13 14:08:57

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16483: Adding condition triggers bulk update for complete database (#1542)

Dev: UpgradeConditionsToRelevance receives two params: surveyId and qid. If the qid is specified, it should only update that question (as per the function doc). But, if surveyId is null, it loops trough all the surveys, which only makes sense if no qid is specified.
Affected Issues
16483
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2020-07-10 13:22 jenseeckhout New Issue
2020-07-29 16:19 gLf Tag Attached: conditions
2020-07-29 16:20 gLf Note Added: 59158
2020-07-29 23:02 cdorin Assigned To => cdorin
2020-07-29 23:02 cdorin Status new => confirmed
2020-08-05 00:45 gabrieljenik Note Added: 59313
2020-08-10 18:12 gabrieljenik Note Added: 59395
2020-08-13 14:09 gabrieljenik Changeset attached => LimeSurvey master 3dbba5b8
2020-08-13 14:09 gabrieljenik Note Added: 59457
2020-08-13 14:09 gabrieljenik Assigned To cdorin => gabrieljenik
2020-08-13 14:09 gabrieljenik Resolution open => fixed
2020-08-13 14:09 ollehar Note Added: 59458
2020-08-13 14:10 ollehar Status confirmed => feedback
2020-08-14 11:03 swendrich Status feedback => resolved
2020-08-17 14:05 lime_release_bot Note Added: 59472
2020-08-17 14:05 lime_release_bot Status resolved => closed
2020-08-18 21:44 gabrieljenik Issue cloned: 16604
2020-08-18 21:44 gabrieljenik Relationship added related to 16604