View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17506Bug reportsComfortUpdatepublic2021-08-17 09:55
ReporterPPRI Assigned Toc_schmitz  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version5.x 
Summary17506: Error while upgrading a database from Ver 3.2.7.11+210809 to Ver 5.0.14+210811
Description

I was updating my Limesurvey through ComfortUpdate. After updating files, it asked to upgrade database. While upgrading a database, I got the following error message.

An non-recoverable error happened during the update. Error details:
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near '='.

File C:\Websites\Limesurvey2019\application\helpers\update\updatedb_helper.php, line 3532.

Please fix this error in your database and try again

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)Version 5.0.14+210811
I will donate to the project if issue is resolvedNo
BrowserGoogle Chrome Version 92.0.4515.131 (Official Build) (64-bit)
Database type & versionSQLServerVersion 12.00.6164
Server OS (if known)Windows Server 2016
Webserver software & version (if known)Microsoft-IIS/10.0
PHP Version7.3.11

Relationships

related to 17501 closedc_schmitz Export of a survey with a single space in the Subquestion of an array results in the word "array" inserted 

Users monitoring this issue

ollehar

Activities

c_schmitz

c_schmitz

2021-08-12 08:27

administrator   ~65905

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

c_schmitz

c_schmitz

2021-08-12 08:28

administrator   ~65906

Last edited: 2021-08-12 08:45

@PPRI : can you please apply this patch https://github.com/LimeSurvey/LimeSurvey/commit/a4415187bc5284d97de9c9b20dda276dca1605c6 and see if it fixes the upgrade issue?

PPRI

PPRI

2021-08-12 09:06

reporter   ~65909

tried after applying the fix. No more error message but after processing the db update., the page says "Loading..." at the page, index.php?r=admin/databaseupdate/sa/db/continue/yes and stuck on it.

c_schmitz

c_schmitz

2021-08-12 09:14

administrator   ~65910

Can you enable debug = 2 in application/config/config.php and try again, please? Paste the complete error message here.

PPRI

PPRI

2021-08-12 09:32

reporter   ~65911

Loading...

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8388616 bytes) in C:\Websites\Limesurvey2019\framework\db\CDbCommand.php on line 518

c_schmitz

c_schmitz

2021-08-12 09:35

administrator   ~65912

Ok, so you have run out of memory.
You will need to raise your PHP memory limit from 256 MB to something higher in your PHP configuration.
I would recommend 512, then see if that helped.

PPRI

PPRI

2021-08-12 09:43

reporter   ~65913

Loading...

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in C:\Websites\Limesurvey2019\framework\db\CDbCommand.php on line 518

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 135168 bytes) in C:\Websites\Limesurvey2019\framework\logging\CLogger.php on line 150

ollehar

ollehar

2021-08-12 09:47

administrator   ~65914

Is that the complete error message? No stack trace?

Make sure debugsql => 0, not 1, in config.php.

PPRI

PPRI

2021-08-12 09:55

reporter   ~65915

That's all with debug'=>2, 'debugsql'=>0

c_schmitz

c_schmitz

2021-08-12 09:56

administrator   ~65916

Last edited: 2021-08-12 09:57

Please try to raise it further then. At some point it will work.
How many surveys do you have in your instance in total?

PPRI

PPRI

2021-08-12 10:20

reporter   ~65917

I have 30 surveys and only 7 surveys are active and running. I will try to raise the memory limit more.

ollehar

ollehar

2021-08-12 10:35

administrator   ~65918

Thank you, we're reviewing the code to reduce the memory usage.

PPRI

PPRI

2021-08-12 10:44

reporter   ~65919

I set memory_limit = 2048M and got the new error.

====
Error
Wrong parameters for CException([string $message [, long $code [, Throwable $previous = NULL]]])

C:\Websites\Limesurvey2019\application\models\LSActiveRecord.php(370)

358 }
359
360 /
361 Decrypt single value
362
@param string $value String value which needs to be decrypted
363 @return string the decrypted string
364
/
365 public static function decryptSingleOld($value = ''): string
366 {
367 static $sodium = null;
368 if (!isset($sodium)) {
369 // load sodium library
370 $sodium = Yii::app()->sodiumOld;
371 }
372 // if $value is provided, it would decrypt
373 if ($value) {
374 return $sodium->decrypt($value);
375 }
376 return '';
377 }
378
379
380 /

381 Enrypt single value
382
@param string $value String value which needs to be encrypted
Stack Trace
#0
– C:\Websites\Limesurvey2019\application\core\LSSodiumOld.php(147): Exception->__construct("500", "Configuration file already exist")
142 /
143 protected function generateEncryptionKeys()
144 {
145 if (is_file(APPPATH . 'config/security.php')) {
146 // Never replace an existing file
147 throw new CException(500, gT("Configuration file already exist"));
148 }
149 $sEncryptionKeypair = ParagonIE_Sodium_Compat::crypto_sign_keypair();
150 $sEncryptionPublicKey = ParagonIE_Sodium_Compat::bin2hex(ParagonIE_Sodium_Compat::crypto_sign_publickey($sEncryptionKeypair));
151 $sEncryptionSecretKey = ParagonIE_Sodium_Compat::bin2hex(ParagonIE_Sodium_Compat::crypto_sign_secretkey($sEncryptionKeypair));
152 $sEncryptionKeypair = ParagonIE_Sodium_Compat::bin2hex($sEncryptionKeypair);
#1
– C:\Websites\Limesurvey2019\application\core\LSSodiumOld.php(49): LSSodiumOld->generateEncryptionKeys()
44
@throws SodiumException
45 /
46 protected function checkIfKeyExists()
47 {
48 if (empty(Yii::app()->getConfig('encryptionkeypair'))) {
49 $this->generateEncryptionKeys(); //return false;
50 }
51 if ($this->sEncryptionKeypair === null) {
52 $this->sEncryptionKeypair = $this->getEncryptionKey();
53 }
54 if ($this->sEncryptionPublicKey === null) {
#2
– C:\Websites\Limesurvey2019\application\core\LSSodiumOld.php(25): LSSodiumOld->checkIfKeyExists()
20
21 if ($this->bLibraryExists === false) {
22 /
throw new SodiumException(sprintf(gT("This operation uses data encryption functions which require Sodium library to be installed, but library was not found. If you don't want to use data encryption, you have to disable encryption in attribute settings. Here is a link to the manual page:
23 %s", 'unescaped'), 'https://manual.limesurvey.org/Data_encryption#Errors'));*/
24 } else {
25 $this->checkIfKeyExists();
26 }
27 }
28
29 /*
30
Check if Sodium library is installed
#3

  • C:\Websites\Limesurvey2019\framework\base\CModule.php(394): LSSodiumOld->init()
    #4
  • C:\Websites\Limesurvey2019\framework\base\CModule.php(103): CModule->getComponent("sodiumOld")
    #5
  • C:\Websites\Limesurvey2019\application\models\LSActiveRecord.php(370): CModule->__get("sodiumOld")
    #6
  • C:\Websites\Limesurvey2019\application\helpers\update\updatedb_helper.php(4699): LSActiveRecord::decryptSingleOld("Iq7H5XNIhvk2UwsizWxsxkMBKBnB65C94r/KdJ9sU4L03rbWBcY=")
    #7
  • C:\Websites\Limesurvey2019\application\helpers\update\update_helper.php(33): db_upgrade_all(449)
    #8
  • C:\Websites\Limesurvey2019\application\controllers\admin\databaseupdate.php(38): CheckForDBUpgrades("yes")
    #9
    unknown(0): databaseupdate->db("yes")
    #10
  • C:\Websites\Limesurvey2019\framework\web\actions\CAction.php(115): ReflectionMethod->invokeArgs(databaseupdate, array("yes"))
    #11
  • C:\Websites\Limesurvey2019\application\core\Survey_Common_Action.php(86): CAction->runWithParamsInternal(databaseupdate, ReflectionMethod, array("r" => "admin/databaseupdate/sa/db/continue/yes", "sa" => "db", "continue" => "yes"))
    #12
  • C:\Websites\Limesurvey2019\framework\web\CController.php(308): Survey_Common_Action->runWithParams(array("r" => "admin/databaseupdate/sa/db/continue/yes", "sa" => "db", "continue" => "yes"))
    #13
  • C:\Websites\Limesurvey2019\framework\web\CController.php(286): CController->runAction(databaseupdate)
    #14
  • C:\Websites\Limesurvey2019\framework\web\CController.php(265): CController->runActionWithFilters(databaseupdate, array())
    #15
  • C:\Websites\Limesurvey2019\application\controllers\AdminController.php(202): CController->run("databaseupdate")
    #16
  • C:\Websites\Limesurvey2019\framework\web\CWebApplication.php(282): AdminController->run("databaseupdate")
    #17
  • C:\Websites\Limesurvey2019\framework\web\CWebApplication.php(141): CWebApplication->runController("admin/databaseupdate/sa/db/continue/yes")
    #18
  • C:\Websites\Limesurvey2019\framework\base\CApplication.php(185): CWebApplication->processRequest()
    #19
  • C:\Websites\Limesurvey2019\index.php(192): CApplication->run()
    2021-08-12 03:41:39 Microsoft-IIS/10.0 Yii Framework/1.1.24-dev
ollehar

ollehar

2021-08-12 10:56

administrator   ~65920

I pushed a fix here: https://github.com/LimeSurvey/LimeSurvey/commit/2bf863b0563cd9896b8369af8edb3543f68d9192

But this will still throw an exception, just a "correct" exception.

c_schmitz

c_schmitz

2021-08-12 11:24

administrator   ~65921

Can you start the upgrade from scratch from a database and file backup? You might now have the problem that some files/database are half-way updated creating follow-up errors.

ollehar

ollehar

2021-08-12 15:30

administrator   ~65926

Version 5.1.1 released, please try again with this new version and let us know if any problems remain. Thank you!

PPRI

PPRI

2021-08-12 16:56

reporter   ~65930

To test a fresh update from the previous version like c_schmitz suggested, I built a new website with my code and database backups but Version 5.xxx is gone from the ComfortUpdate now so I couldn't test it.

PPRI

PPRI

2021-08-12 17:04

reporter   ~65931

Never mind, I see 5.1.1 update at the ComfortUpdate now. I will let you know my test result soon.

PPRI

PPRI

2021-08-12 17:11

reporter   ~65933

while updating I got this error message. Please see the screenshot added.

ollehar

ollehar

2021-08-12 17:44

administrator   ~65938

@PPRI The service was temporarily disabled while we debugged it, but should be fine since around when you tried it. Can you reload the page and try again, please?

PPRI

PPRI

2021-08-12 18:13

reporter   ~65939

Error again but different message.

=====

An non-recoverable error happened during the update. Error details:
Configuration file already exist

File C:\Websites\Limesurvey2019_Org\application\core\LSSodiumOld.php, line 25.
Please fix this error in your database and try again

ollehar

ollehar

2021-08-12 18:28

administrator   ~65941

To know where your database update halted, can you run this query and show us the result?

SELECT * FROM settings_global WHERE stg_name = 'dbversion';

(Assuming your table prefix is empty - it might be "lime_" too).

You can also inspect the file application/config/security.php and check which values it has (but don't paste them here, the values are secret).

Thank you.

PPRI

PPRI

2021-08-12 19:00

reporter   ~65946

DBVersion = 451

I have $config['encryptionnonce'] and $config['encryptionsecretboxkey'] in the security.php.

ollehar

ollehar

2021-08-12 19:37

administrator   ~65947

@PPRI OK, we've released 5.1.2 with a fix for this. Please test and report any other issues. Thank you!

ollehar

ollehar

2021-08-12 19:54

administrator   ~65949

Actually, might still be a bug in that version related to encryption of emailsmtppassword. We'll release a fix tomorrow.

PPRI

PPRI

2021-08-12 19:54

reporter   ~65950

Thank you so much for all your helps. It has been updated successfully now.

Related Changesets

LimeSurvey: master a4415187

2021-08-12 10:26

c_schmitz


Details Diff
Fixed issue 17506: Error while upgrading a database when using MSSQL Affected Issues
17506
mod - application/helpers/update/updatedb_helper.php Diff File

Issue History

Date Modified Username Field Change
2021-08-12 06:03 PPRI New Issue
2021-08-12 08:27 c_schmitz Changeset attached => LimeSurvey master a4415187
2021-08-12 08:27 c_schmitz Note Added: 65905
2021-08-12 08:27 c_schmitz Bug heat 0 => 2
2021-08-12 08:27 c_schmitz Assigned To => c_schmitz
2021-08-12 08:27 c_schmitz Resolution open => fixed
2021-08-12 08:28 c_schmitz Status new => feedback
2021-08-12 08:28 c_schmitz Note Added: 65906
2021-08-12 08:45 c_schmitz Sync to Zoho Project => |Yes|
2021-08-12 09:06 PPRI Note Added: 65909
2021-08-12 09:06 PPRI File Added: Screenshot 2021-08-12 015415.png
2021-08-12 09:06 PPRI Bug heat 2 => 4
2021-08-12 09:06 PPRI Status feedback => assigned
2021-08-12 09:14 c_schmitz Status assigned => feedback
2021-08-12 09:14 c_schmitz Note Added: 65910
2021-08-12 09:32 PPRI Note Added: 65911
2021-08-12 09:32 PPRI Status feedback => assigned
2021-08-12 09:33 ollehar Issue Monitored: ollehar
2021-08-12 09:33 ollehar Bug heat 4 => 6
2021-08-12 09:35 c_schmitz Note Added: 65912
2021-08-12 09:36 c_schmitz Status assigned => feedback
2021-08-12 09:43 PPRI Note Added: 65913
2021-08-12 09:43 PPRI Status feedback => assigned
2021-08-12 09:47 ollehar Note Added: 65914
2021-08-12 09:47 ollehar Bug heat 6 => 8
2021-08-12 09:55 PPRI Note Added: 65915
2021-08-12 09:56 c_schmitz Note Added: 65916
2021-08-12 09:57 c_schmitz Note Edited: 65916
2021-08-12 10:20 PPRI Note Added: 65917
2021-08-12 10:35 ollehar Note Added: 65918
2021-08-12 10:44 PPRI Note Added: 65919
2021-08-12 10:56 ollehar Note Added: 65920
2021-08-12 11:24 c_schmitz Note Added: 65921
2021-08-12 15:30 ollehar Note Added: 65926
2021-08-12 15:30 ollehar Status assigned => feedback
2021-08-12 16:34 c_schmitz Relationship added related to 17501
2021-08-12 16:56 PPRI Note Added: 65930
2021-08-12 16:56 PPRI Status feedback => assigned
2021-08-12 17:04 PPRI Note Added: 65931
2021-08-12 17:11 PPRI Note Added: 65933
2021-08-12 17:11 PPRI File Added: Screenshot 2021-08-12 110959.png
2021-08-12 17:44 ollehar Note Added: 65938
2021-08-12 18:13 PPRI Note Added: 65939
2021-08-12 18:28 ollehar Note Added: 65941
2021-08-12 18:46 PPRI File Deleted: Screenshot 2021-08-12 015415.png
2021-08-12 19:00 PPRI Note Added: 65946
2021-08-12 19:37 ollehar Note Added: 65947
2021-08-12 19:54 ollehar Note Added: 65949
2021-08-12 19:54 PPRI Note Added: 65950
2021-08-12 22:05 ollehar Status assigned => resolved
2021-08-17 09:55 c_schmitz Status resolved => closed