Error setting up Questionarire Service

Asked by Jeff Wood on 2020-04-02

We're setting up queXS (v2.2.3) alongside our existing LimeSurvey installations (V 2.67.3). I'm excited to try the app, but I'm getting an error trying to set up a questionnaire service "Unable to connect to https://web.myUniv.edu/MyProject/survey/index.php?r=admin/remotecontrol"
I know the server to be running because I use it every day and have tried connecting with credentials for an account specifically intended for RC and with the main admin account. Nothing has worked.

What debugging steps should I take?

Question information

Language:
English Edit question
Status:
Solved
For:
queXS Edit question
Assignee:
No assignee Edit question
Solved by:
Adam Zammit
Solved:
2020-05-11
Last query:
2020-05-11
Last reply:
2020-05-10
Adam Zammit (adamzammit) said : #1

Hi Jeff,

The error "Unable to connect" comes from the JsonRPCClient code itself and indicates an inability to physically connect to the URL. Can you please confirm that there is no firewall / other restriction in place that would avoid the particular server that queXS is running on from connecting to the URL that you specify?

Good luck and let me know if you need any more assistance.

Adam

Jeff Wood (jlwood) said : #2

Hi Adam,
Thanks for your help. I wanted to write back to let you know what happened on this problem. I was attempting to instal quexs alongside our existing limesurvey installation. Turns out (according to the Network engineer) that our load-balanced server setup prevents the web servers from making curl and fopen calls back to themselves. To make a long story short, I was able to relocate quexs to a new subdomain (php 7, mysql 5.7) and things began to work better. I suspect that other institutions may run into the same trouble since ours isn't an especially unusual setup. Happy to provide more details on t he environment if you'd like.

I'm now having a problem much like I've seen in another post that after completing installation and loading a set of sample data no cases are being assigned to the operators. My sample only has 2 fields, a primary phone and a sequential participant id.
I ran through all the steps you advised in this post: https://answers.launchpad.net/quexs/+question/669839 without success. Do you know what finally fixed things for that user? it isn't clear in the thread.

Adam Zammit (adamzammit) said : #3

Hi Jeff,

Thanks for letting me know how you resolved that issue - great to hear.

I am not sure what resolved the issue for that user in particular but the issues I mention should cover most potential sources of error.

Can you confirm that when visiting the "set default timezone list" page you don't receive an error message about mysql timezones?

Also can you please confirm what message you receive when running the "System wide case sorting" process?

Adam

Jeff Wood (jlwood) said : #4

I'll check those first thing in the morning (I'm on Los Angeles time). Also, it doesn't appear to be in the documentation, by having urlFormat set to 'get' in the limesurvey config.ini seems to be a problem. Can you confirm that this is the case?

-----Original Message-----
From: <email address hidden> <email address hidden> On Behalf Of Adam Zammit
Sent: Sunday, April 19, 2020 6:12 PM
To: Jefferson Wood <email address hidden>
Subject: Re: [Question #689675]: Error setting up Questionarire Service

Your question #689675 on queXS changed:
https://answers.launchpad.net/quexs/+question/689675

Adam Zammit requested more information:
Hi Jeff,

Thanks for letting me know how you resolved that issue - great to hear.

I am not sure what resolved the issue for that user in particular but the issues I mention should cover most potential sources of error.

Can you confirm that when visiting the "set default timezone list" page you don't receive an error message about mysql timezones?

Also can you please confirm what message you receive when running the "System wide case sorting" process?

Adam

--
To answer this request for more information, you can either reply to this email or enter your reply at the following page:
https://answers.launchpad.net/quexs/+question/689675

You received this question notification because you asked the question.

Jeff Wood (jlwood) said : #5

Looks like it didn't complete successfully. Here's what I got:
37 Mon 20 Apr 07:59AM Failed to complete sort. This task took: 5.2621209621429 seconds
35 Mon 20 Apr 07:59AM Sorting cases for B-free OC Community Survey
34 Mon 20 Apr 07:59AM Completed case closing. This task took: 0.010435104370117 seconds
33 Mon 20 Apr 07:59AM Checking for cases open for more than 24 hours
32 Mon 20 Apr 07:59AM Sorting cases process starting

Adam Zammit (adamzammit) said : #6

It is possible the urlFormat set to "get" could interfere - I can't confirm this as I haven't tested it.

A failure to complete a sort indicates there is some issue that will stop cases being assigned.

Can you please try unassigning all current samples and test using a test sample only?

Jeff Wood (jlwood) said : #7

It turns out that using urlFormat 'get' does interfere with the presentation of the survey. I used the method described in the previous post to manually assign instruments to an operator and found that when using 'get' the path to the survey in the administration window was malformed and the token failed. I've since changed the urlFormat to 'path' and (after manually assigning cases) the instrument opens to a new record with the correct token.

HOWEVER, it only works if manually assigning cases as you suggested I removed the existing test sample, made certain that the tables in MySQL were empty, removed the questionnaire, removed all participant records for Limesurvey. then re-added the questionnaire to quefs, re-imported the sample, was careful not to restrict calling time to shifts or certain hours, but the distribution of the sample still failed.

in the php log one error appeard when deleting tha sample:
Fatal error: Uncaught Error: Call to undefined function mysql_errno() in /sites/HealthEquity/CATI/admin/samplelist.php:275 Stack trace: #0 {main} thrown in /sites/HealthEquity/CATI/admin/samplelist.php on line 275

Though the sample records were in fact deleted.

After loading test sample data a popup error occurs if I attempt to search the data:
DataTables warning: table id=bs-table - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

Though I had been able to search the data before using the same test ample

Adam Zammit (adamzammit) said : #8

Thanks Jeff,

I have updated the queXS website to indicate that 'urlFormat' should be set to 'path' not 'get' for compatibility with queXS.

It is possible that the database is now in an inconsistent state - can you confirm if running the system sort process still leads to a failure after removing the old samples and loading the test one? It is possible you may have to return to a fresh queXS database to continue debugging - please let me know how you go.

Adam

Jeff Wood (jlwood) said : #9

I'll wipe the quexs db and start it fresh.

Here's what my Limesurvey config has in it now:

        'urlManager' => array(
            'urlFormat' => 'path',
            'rules' => require('routes.php'),
            'showScriptName' => false,
        )

Is the any reason 'showScriptName' should be set one way or the other?

Adam Zammit (adamzammit) said : #10

showScriptName being true or false should still work with queXS - you will just need to update the Questionnaire RPC settings in queXS to point to the updated URL that is produced when enabling JSON-RPC in LimeSurvey

Jeff Wood (jlwood) said : #11

I've wiped and rebuilt the DB. I'm still not getting cases assigned automatically. Here's what i see when I attempt to sort cases automatically:
Log id Date Log entry
73 Wed 29 Apr 12:41PM Failed to complete sort. This task took: 2.0602629184723 seconds
71 Wed 29 Apr 12:41PM Sorting cases for B-free OC Community Survey
70 Wed 29 Apr 12:41PM Completed case closing. This task took: 0.010478019714355 seconds
69 Wed 29 Apr 12:41PM Checking for cases open for more than 24 hours
68 Wed 29 Apr 12:41PM Sorting cases process starting

I can use 'Supervisor Functions->Case status and assignment' to manually create cases for the sample associated with my survey but doing so does not change the outcome of the Systemwide case sorting process. Also, creating the cases manually does not cause them to appear in the operator queue. I have to also assign them to individuals. I'll do what I can to debug the source of the case sorting error, hoping that whatever is causing that is causing the failure to create and assign cases. Any continued guidance is greatly appreciated.

Jeff Wood (jlwood) said : #12

Some new insights: Evidence suggests that I have an adoDB problem. After adding much debugging code into systemsortprocess.php I've worked out that the script fails silently and no further commands are processed immediately after line 221 $db->StartTrans();

Could you tell me which versions of adoDB you've used and tested? Any other people had a problem with it?

Adam Zammit (adamzammit) said : #13

Hi Jeff,

It could be ADOdb - but I haven't seen issues with it before. I have used the latest master from github but also most stable releases without issue.

If you are getting stuck let me know if you are able to give me SSH access to have a look and see for myself.

Adam

Jeff Wood (jlwood) said : #14

Thanks for the offer. I'm not sure how I can provide ssh access since I'm on an institutional server, but I'll see what I can do. In the meantime I'll send you an admin login to the system as it stands so you can see how it's behaving.

-----Original Message-----
From: <email address hidden> <email address hidden> On Behalf Of Adam Zammit
Sent: Monday, May 4, 2020 6:35 PM
To: Jefferson Wood <email address hidden>
Subject: Re: [Question #689675]: Error setting up Questionarire Service

Your question #689675 on queXS changed:
https://answers.launchpad.net/quexs/+question/689675

    Status: Open => Needs information

Adam Zammit requested more information:
Hi Jeff,

It could be ADOdb - but I haven't seen issues with it before. I have used the latest master from github but also most stable releases without issue.

If you are getting stuck let me know if you are able to give me SSH access to have a look and see for myself.

Adam

--
To answer this request for more information, you can either reply to this email or enter your reply at the following page:
https://answers.launchpad.net/quexs/+question/689675

You received this question notification because you asked the question.

Jeff Wood (jlwood) said : #15

Thank you for looking things over Adam! After your comments I began to do a little testing and now I'm finally having a little success with this problem. I can't safely change the global sql mode on my server, so I added this block of code at line 78 in db.inc.php

/*
 * Block added to ensure sql_mode not set to strict in session*
 */
$sqlGet = "SELECT @@SESSION.sql_mode;";
$sqlSet = "SET SESSION sql_mode = '';";
$result = "Original sql_mode: ";
$result .= $db->execute($sqlGet);
$result .= " changed to ";
$db->execute($sqlSet);
$result .= $db->execute($sqlGet);
console.log("$result");
/*
* end of block
*/

I also had to wipe out the database again and rebuild it but now cases are being created and assigned automatically. I haven't tested every function yet but this bit of progress clears up a lot of questions. The only lines in that code that matter of course are

$sqlSet = "SET SESSION sql_mode = '';";
$db->execute($sqlSet);

The rest was just so I could sort of see what's going on. I did a quick look for any other places where MySQL sessions might get initiated and didn't see any obvious ones except perhaps in the VOIP code (which I'm not using at the moment). If there's anywhere else you think it might be important let me know. And thanks so much for all your help and advice.

Best Adam Zammit (adamzammit) said : #16

Thank you Jeff.

Sorry it took so long to get to the bottom of.

I'll now mark this as a bug and update the queXS code to set this mode in db.inc.php as you have described.

Adam

Jeff Wood (jlwood) said : #17

Glad I could be helpful. I really appreciate all your assistance. Though I'm not using VOIP, I think I also saw a line in the voip-related code where db sessions are initiated, so potentially the same problem there.

-----Original Message-----
From: <email address hidden> <email address hidden> On Behalf Of Adam Zammit
Sent: Sunday, May 10, 2020 3:49 PM
To: Jefferson Wood <email address hidden>
Subject: Re: [Question #689675]: Error setting up Questionarire Service

Your question #689675 on queXS changed:
https://answers.launchpad.net/quexs/+question/689675

    Status: Open => Answered

Adam Zammit proposed the following answer:
Thank you Jeff.

Sorry it took so long to get to the bottom of.

I'll now mark this as a bug and update the queXS code to set this mode in db.inc.php as you have described.

Adam

--
If this answers your question, please go to the following page to let us know that it is solved:
https://answers.launchpad.net/quexs/+question/689675/+confirm?answer_id=15

If you still need help, you can reply to this email or go to the following page to enter your feedback:
https://answers.launchpad.net/quexs/+question/689675

You received this question notification because you asked the question.

Jeff Wood (jlwood) said : #18

Thanks Adam Zammit, that solved my question.