MantisBT - TestLink
View Issue Details
0008717TestLinkExport/Importpublic2019-07-08 08:482019-07-15 12:31
stef-lhm 
fman 
highmajoralways
resolvedfixed 
1.9.19 (2019 Q1) 
1.9.19.01 (1.9.19 fixes) 
MySQL 5.7.25
FF
5.6.25
TBD
0008717: Testspec - Testsuite - Download Testsuite Doc Pseudo Word - DB Access Error
When clicking the little Word Icon (Download Testsuite Document Pseudo Word OR HTML) the following DB Access Error comes as result.

DB Access Error - debug_print_backtrace() OUTPUT START

 ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200)

            Having this additional Information could be useful for reporting

            issue to development TEAM.

 ==============================================================================

#0 database->exec_query( /* Class:requirement_mgr - Method: getActiveForTCVersion */ SELECT REQ.id,REQ.id AS req_id,REQ.req_doc_id,NHREQ.name AS title, RCOV.is_active, NHRS.name AS req_spec_title,RCOV.testcase_id, REQV.id AS req_version_id, REQV.version FROM requirements REQ JOIN req_specs RSPEC ON REQ.srs_id = RSPEC.id JOIN req_coverage RCOV ON RCOV.req_id = REQ.id JOIN nodes_hierarchy NHRS ON NHRS.id=RSPEC.id JOIN nodes_hierarchy NHREQ ON NHREQ.id=REQ.id JOIN req_versions REQV ON RCOV.req_version_id=REQV.id WHERE RCOV.tcversion_id IN () AND RCOV.is_active=1 , -1, -1) called at [/app/appdata289/apache/testlink-1.9.19/lib/functions/database.class.php:759]
#1 database->get_recordset( /* Class:requirement_mgr - Method: getActiveForTCVersion */ SELECT REQ.id,REQ.id AS req_id,REQ.req_doc_id,NHREQ.name AS title, RCOV.is_active, NHRS.name AS req_spec_title,RCOV.testcase_id, REQV.id AS req_version_id, REQV.version FROM requirements REQ JOIN req_specs RSPEC ON REQ.srs_id = RSPEC.id JOIN req_coverage RCOV ON RCOV.req_id = REQ.id JOIN nodes_hierarchy NHRS ON NHRS.id=RSPEC.id JOIN nodes_hierarchy NHREQ ON NHREQ.id=REQ.id JOIN req_versions REQV ON RCOV.req_version_id=REQV.id WHERE RCOV.tcversion_id IN () AND RCOV.is_active=1 ) called at [/app/appdata289/apache/testlink-1.9.19/lib/functions/requirement_mgr.class.php:4604]
0000002 requirement_mgr->getActiveForTCVersion() called at [/app/appdata289/apache/testlink-1.9.19/lib/functions/print.inc.php:1444]
0000003 renderTestCaseForPrinting(database Object ([db] => ADODB_mysqli Object ([databaseType] => mysqli,[dataProvider] => mysql,[hasInsertID] => 1,[hasAffectedRows] => 1,[metaTablesSQL] => SELECT
            TABLE_NAME,
            CASE WHEN TABLE_TYPE = 'VIEW' THEN 'V' ELSE 'T' END
        FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_SCHEMA=,[metaColumnsSQL] => SHOW COLUMNS FROM `%s`,[fmtTimeStamp] => 'Y-m-d H:i:s',[hasLimit] => 1,[hasMoveFirst] => 1,[hasGenID] => 1,[isoDates] => 1,[sysDate] => CURDATE(),[sysTimeStamp] => NOW(),[hasTransactions] => 1,[forceNewConnect] => 1,[poorAffectedRows] => 1,[clientFlags] => 0,[substr] => substring,[port] => 3306,[socket] => ,[_bindInputArray] => ,[nameQuote] => `,[optionFlags] => Array ([0] => Array ([0] => 5,[1] => 0)),[arrayClass] => ADORecordSet_array_mysqli,[multiQuery] => ,[_genIDSQL] => update %s set id=LAST_INSERT_ID(id+1);,[_genSeqSQL] => create table if not exists %s (id int not null),[_genSeqCountSQL] => select count(*) from %s,[_genSeq2SQL] => insert into %s values (%s),[_dropSeqSQL] => drop table if exists %s,[database] => testlink,[host] => localhost,[user] => a51_root,[password] => not stored,[debug] => ,[maxblobsize] => 262144,[concat_operator] => +,[length] => length,[random] => rand(),[upperCase] => upper,[fmtDate] => 'Y-m-d',[true] => 1,[false] => 0,[replaceQuote] => \',[charSet] => ,[metaDatabasesSQL] => ,[uniqueOrderBy] => ,[emptyDate] => ,[emptyTimeStamp] => ,[lastInsID] => ,[hasTop] => ,[readOnly] => ,[genID] => 0,[raiseErrorFn] => ,[cacheSecs] => 3600,[memCache] => ,[memCacheHost] => ,[memCachePort] => 11211,[memCacheCompress] => ,[sysUTimeStamp] => ,[noNullStrings] => ,[numCacheHits] => 0,[numCacheMisses] => 0,[pageExecuteCountRows] => 1,[uniqueSort] => ,[leftOuter] => ,[rightOuter] => ,[ansiOuter] => ,[autoRollback] => ,[fnExecute] => ,[fnCacheExecute] => ,[blobEncodeType] => ,[rsPrefix] => ADORecordSet_,[autoCommit] => 1,[transOff] => 0,[transCnt] => 0,[fetchMode] => 2,[null2null] => null,[bulkBind] => ,[_oldRaiseFn] => ,[_transOK] => ,[_connectionID] => mysqli Object ([affected_rows] => ,[client_info] => ,[client_version] => ,[connect_errno] => ,[connect_error] => ,[errno] => ,[error] => ,[error_list] => ,[field_count] => ,[host_info] => ,[info] => ,[insert_id] => ,[server_info] => ,[server_version] => ,[stat] => ,[sqlstate] => ,[protocol_version] => ,[thread_id] => ,[warning_count] => ),[_errorMsg] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND RCOV.is_active=1' at line 1,[_errorCode] => ,[_queryID] => 1,[_isPersistentConnection] => ,[_evalAll] => ,[_affected] => ,[_logsql] => ,[_transmode] => ,[] => Array (),[databaseName] => testlink),[queries_array] => Array (),[is_connected] => 1,[nQuery] => 0,[overallDuration] => 0,[dbType] => mysqli,[] => 0,[] => 0), Array ([parent_id] => 503606,[id] => 503639,[name] => Ubung1,[childNodes] => ,[node_table] => testcases,[node_type_id] => 3,[node_order] => 1000), Array ([toc] => 1,[headerNumbering] => 1,[header] => 1,[summary] => 1,[body] => 1,[author] => 1,[keyword] => 1,[cfields] => 1,[requirement] => 1,[req_spec_scope] => 1,[req_spec_author] => 1,[req_spec_overwritten_count_reqs] => 1,[req_spec_type] => 1,[req_spec_cf] => 1,[req_scope] => 1,[req_author] => 1,[req_status] => 1,[req_type] => 1,[req_cf] => 1,[req_relations] => 1,[req_linked_tcs] => 1,[req_coverage] => 1,[displayVersion] => 1,[execResultsByCFOnExecCombination] => 1,[notes] => 1,[step_exec_notes] => ,[passfail] => ,[step_exec_status] => ,[build_cfields] => 1,[metrics] => 1,[docType] => testspec,[tocCode] =>
Testspec -> Testsuite -> click one of the two Document Icons
No tags attached.
duplicate of 0008556resolved fman ''DB Access Error'', when clicked on "Test Suite Document (HTML) on New Window'' 
? fresh_tl_dump.sql (74,396) 2019-07-10 20:57
http://mantis.testlink.org/file_download.php?file_id=5181&type=bug
Issue History
2019-07-08 08:48stef-lhmNew Issue
2019-07-08 10:18fmanNote Added: 0028991
2019-07-08 11:00stef-lhmNote Added: 0028993
2019-07-10 20:11alainpNote Added: 0028997
2019-07-10 20:16fmanNote Added: 0028998
2019-07-10 20:21alainpNote Added: 0029001
2019-07-10 20:22alainpNote Edited: 0029001bug_revision_view_page.php?bugnote_id=29001#r5882
2019-07-10 20:27fmanNote Added: 0029003
2019-07-10 20:57alainpNote Added: 0029004
2019-07-10 20:57alainpFile Added: fresh_tl_dump.sql
2019-07-10 20:58alainpNote Edited: 0029004bug_revision_view_page.php?bugnote_id=29004#r5884
2019-07-13 09:26fmanNote Added: 0029017
2019-07-13 09:29fmanNote Edited: 0029017bug_revision_view_page.php?bugnote_id=29017#r5886
2019-07-13 09:29fmanNote View State: 0029017: public
2019-07-13 09:34fmanNote Added: 0029018
2019-07-13 09:36fmanNote Edited: 0029018bug_revision_view_page.php?bugnote_id=29018#r5888
2019-07-13 10:05fmanNote View State: 0029018: public
2019-07-13 10:07fmanNote Added: 0029019
2019-07-13 10:07fmanAssigned To => fman
2019-07-13 10:07fmanStatusnew => feedback
2019-07-13 10:09fmanNote Edited: 0029004bug_revision_view_page.php?bugnote_id=29004#r5889
2019-07-13 10:40fmanNote Added: 0029020
2019-07-13 10:42fmanNote Edited: 0029020bug_revision_view_page.php?bugnote_id=29020#r5891
2019-07-14 22:54alainpNote Added: 0029023
2019-07-15 08:51stef-lhmNote Added: 0029024
2019-07-15 08:51stef-lhmStatusfeedback => assigned
2019-07-15 10:25fmanNote Added: 0029025
2019-07-15 10:27fmanQA Team - Task Workflow Status => TBD
2019-07-15 10:27fmanFixed in Version => 1.9.19.01 (1.9.19 fixes)
2019-07-15 10:27fmanStatusassigned => resolved
2019-07-15 10:27fmanResolutionopen => fixed
2019-07-15 12:06alainpNote Added: 0029026
2019-07-15 12:29fmanNote Added: 0029027
2019-07-15 12:30fmanNote Edited: 0029027bug_revision_view_page.php?bugnote_id=29027#r5897
2019-07-15 12:31fmanNote Edited: 0029027bug_revision_view_page.php?bugnote_id=29027#r5898
2019-07-15 12:31fmanRelationship addedduplicate of 0008556

Notes
(0028991)
fman   
2019-07-08 10:18   
WHERE RCOV.tcversion_id IN ()
seems a migration issue
(0028993)
stef-lhm   
2019-07-08 11:00   
That means the tables are not corrct anymore?
(0028997)
alainp   
2019-07-10 20:11   
I'm hitting the exact same problem after migrating from an old version to 1.9.19.

It happens on old testsuites as well as testsuites created entirely after the migration.

I've tried to find the origin of the problem, without success.

Just to be sure I just tried on a fresh install in which I created a single testsuite with a single test case, and I can reproduce the problem.
(0028998)
fman   
2019-07-10 20:16   
the migration has been tested by the feature sponsor that has migrated from version 1.9.14.

It's very difficult to do any action if there are no more information like:
starting version
how migration has been done

only way to provide any help is to have a copy of the starting DB
(0029001)
alainp   
2019-07-10 20:21   
(edited on: 2019-07-10 20:22)
As I just said, I did reproduce the problem on a fresh installation.

In the case of my production testlink, I migrated from version 1.9.4 following every step:

MariaDB [testlink]> select * from db_version;
+-----------+---------------------+-------------------------------+
| version   | upgrade_ts          | notes                         |
+-----------+---------------------+-------------------------------+
| DB 1.5    | 2012-12-13 14:44:41 | TestLink 1.9.4                |
| DB 1.6    | 2019-07-08 08:34:01 | TestLink 1.9.6                |
| DB 1.9.8  | 2019-07-08 08:34:22 | TestLink 1.9.8                |
| DB 1.9.9  | 2019-07-08 08:34:43 | TestLink 1.9.9                |
| DB 1.9.11 | 2019-07-08 08:35:08 | TestLink 1.9.11               |
| DB 1.9.12 | 2019-07-08 08:35:21 | TestLink 1.9.12               |
| DB 1.9.13 | 2019-07-08 08:35:47 | TestLink 1.9.13               |
| DB 1.9.14 | 2019-07-08 08:36:02 | TestLink 1.9.14               |
| DB 1.9.15 | 2019-07-08 08:36:21 | TestLink 1.9.15               |
| DB 1.9.16 | 2019-07-08 08:36:42 | TestLink 1.9.16               |
| DB 1.9.17 | 2019-07-08 08:44:39 | TestLink 1.9.17 Alan Turing   |
| DB 1.9.18 | 2019-07-08 08:45:00 | TestLink 1.9.18 Gaura         |
| DB 1.9.19 | 2019-07-08 08:45:16 | TestLink 1.9.19 Metonic cycle |
+-----------+---------------------+-------------------------------+
13 rows in set (0.000 sec)


I can't provide you with a copy of the starting DB for obvious reasons, but as I already said, I can reproduce it on a fresh install.

If I can provide any other info, please do not hesitate.

Thanks.

(0029003)
fman   
2019-07-10 20:27   
If you can reproduce in a fresh install, then please provide clear test case in order to be sure we are using the same scenario.
(0029004)
alainp   
2019-07-10 20:57   
(edited on: 2019-07-13 10:09)
OK.

1. Started a new mariadb container with an empty "testlink" database and associated "testlink" user.
2. Started a PHP container with testlink at the www root
3. Connected to testlink and followed the installation steps
4. Ran the testlink_create_udf0.sql script
5. Connected to testlink with admin/admin
6. Created a new test projet, a new test spec, a new test suite and a new test case with 1 step.

-> This gives me the attached SQL dump

7. Click on the testsuite, then on the cogwheel, then on the MSWord icon

And there I have it, the error pasted in this bug description.

Hope this helps.

(0029017)
fman   
2019-07-13 09:26   
(edited on: 2019-07-13 09:29)
1. get code from github @20190713
2. do fresh install
3. create test project P1 without REQUIREMENT Management
4. create test suite TS-100
5. create test case TC-01, no steps
6. access to Test Suite TS-100, use the book icon to create the pseudo word.
No issue

7. add a step to TC-01
8. repeat (6)
No issue

Work on Test Project WITH REQ feature enabled
1. create test project P2
2. create test suite TS-100
3. create test case TC-01, no steps
4. access to Test Suite TS-100, use the book icon to create the pseudo word.
No issue

(0029018)
fman   
2019-07-13 09:34   
(edited on: 2019-07-13 09:36)
The details when this issue was created point to:

Class:requirement_mgr - Method: getActiveForTCVersion

I've done a search for getActiveForTCVersion

$ grep -rl 'function getActiveForTCVersion(' *
lib/functions/requirement_mgr.class.php

Used in
$ grep -r 'getActiveForTCVersion(' *
lib/execute/execSetResults.php:      $gui->req_details = $req_mgr->getActiveForTCVersion($tcversion_id);

lib/functions/print.inc.php:    $requirements = (array)$st->req_mgr->getActiveForTCVersion($tcVersionID);



This means that the issue can be reproduced only on Test Projects where Requiement Specification feature is active

(0029019)
fman   
2019-07-13 10:07   
I've done two improvements that will allow isolating the test case that is generating the issue.
Please get the latest code from github, and try it in a sandbox.

please provide feedback regarding your findings
(0029020)
fman   
2019-07-13 10:40   
(edited on: 2019-07-13 10:42)
@alainp
I've got code from branch 1.9.19.01 and used it with the DB you have provided,
I'm not able to reproduce the issue

(0029023)
alainp   
2019-07-14 22:54   
@fman
Indeed, I updated my container to use code from GitHub branch tl1.9.19.01 and the problem is solved, including using our migrated production data.
Thanks a lot.
(0029024)
stef-lhm   
2019-07-15 08:51   
What has changed in 1.9.19.01 in comparision to 1.9.19?
I will do the chnage per hand to fix it, so i dont need to do an update. In our organisation its not just an update, cause we got an extreme overhead process for changing productive systems.
so a quick change to some lines in source code, will be much easier for me.

thanx for solving the problem.
(0029025)
fman   
2019-07-15 10:25   
@stef-lhm
theoretically, each commit has a description of the changes done or the ticket number.
This is the only help I can provide.

regards
(0029026)
alainp   
2019-07-15 12:06   
My 2 cents to help a bit in this regard: https://github.com/TestLinkOpenSourceTRMS/testlink-code/compare/1.9.19...tl1.9.19.01 [^]
(and probably in particular, this commit: https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/3c91487d6df1abcbebe9b31c9abdcb53931c00e6 [^] )
(0029027)
fman   
2019-07-15 12:29   
(edited on: 2019-07-15 12:31)
my 'warm suggestion' do not update just a piece of code, upgrade the full versions, because no support can be provided with a code in this state.
As I said in my previous note: commit log 99% of times provides the answer and the old approach => always to search for similar issues before reporting a new one is always the winner one.