QWP timeout issue? Ben Bimber  2010-08-27 06:27
Status: Closed
 
There's a weird issue with embedded QWPs and long queries. I've observed this for a while, but have just recently began to investigate it:

We have a page here that loads QWPs. You pick a report, and the corresponding QWP loads below it. Page here:
https://xnight.primate.wisc.edu:8443/labkey/EHR_Reporting/WNPRC/EHR/animalHistory.view?

The same code is used to load every query. Most of the queries load quickly, without issue. However, some of the queries are just slower to run. The problem is that after 30 seconds, onSuccess seems to get called no matter what. When that happens, I see this in the console:

uncaught exception: Couldn't get dataregion 'aqwp104' object.

this happens after 30 secs very consistently. i have the timeout option on the QWP set to 0. After 30 secs I also see this in the intellij console:

ERROR Table 2010-08-27 08:25:47,668 t: http-8080-Processor22 : internalExecuteQuery
org.postgresql.util.PSQLException: ERROR: canceling statement due to user request
(full message below)

Anyone have suggestions on things to try?




Below is the code that loads the QWP, including the QWP config:

    loadQuery: function(rowData, subject)
    {
        var filterArray = [LABKEY.Filter.create('Id', subject, LABKEY.Filter.Types.EQUALS_ONE_OF)];
        var div = document.getElementById('reportDiv');
        var target = div.appendChild(document.createElement('span'));

        var queryConfig = {
            title: rowData.get("ReportTitle") + ": " + subject.replace(/;/g, "; "),
            schemaName: rowData.get("Schema"),
            queryName: rowData.get("QueryName"),
            allowChooseQuery: false,
            allowChooseView: false,
            showInsertNewButton: false,
            showDeleteButton: false,
            showDetailsColumn: true,
            showUpdateColumn: false,
            showRecordSelectors: true,
            buttonBarPosition: 'top',
            timeout: 0,
            filters: filterArray,
            successCallback: this.endMsg,
            errorCallback: function(error){target.innerHTML = 'ERROR: ' + error.exception + '<br>'; this.endMsg; EHR.UTILITIES.onError(error)},
            scope: this
        };

        if (rowData.get("View"))
        {
            queryConfig.viewName = rowData.get("View")
        }

        if (rowData.get("ContainerPath"))
        {
            queryConfig.containerPath = rowData.get("ContainerPath");
        }

        new LABKEY.QueryWebPart(queryConfig).render(target);

    },

    endMsg: function(){
//this shows that the callback is being called.
        console.log('Success callback called');
//this turns off the spinning wheel 'Loading...' indicator
Ext.fly(this.wheel).remove();

        //log using analytics
        var loadTime = new Date().getTime() - this.startTime;
        pageTracker._trackEvent('AnimalReport', 'LoadTime', this.reportName, loadTime);
    }


Below is the full error I see in the console:

ERROR Table 2010-08-27 08:25:47,668 t: http-8080-Processor22 : internalExecuteQuery
org.postgresql.util.PSQLException: ERROR: canceling statement due to user request
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
    at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
    at org.labkey.api.data.StatementWrapper.executeQuery(StatementWrapper.java:540)
    at org.labkey.api.data.Table._executeQuery(Table.java:120)
    at org.labkey.api.data.Table.executeQuery(Table.java:280)
    at org.labkey.api.data.Table.selectForDisplay(Table.java:1386)
    at org.labkey.api.data.Table.access$300(Table.java:53)
    at org.labkey.api.data.Table$2.call(Table.java:1398)
    at org.labkey.api.data.Table$2.call(Table.java:1395)
    at org.labkey.api.data.AsyncQueryRequest$1.run(AsyncQueryRequest.java:69)
    at java.lang.Thread.run(Thread.java:619)
ERROR Table 2010-08-27 08:25:47,670 t: http-8080-Processor22 : SQL [5292]
    -- <QueryServiceImpl.getSelectSQL()>
        SELECT *
        FROM (
        SELECT
        Hematology_Results.Id AS Id,
        Hematology_Results.Date AS Date,
        Hematology_Results.testid AS testid,
        Hematology_Results$testid$.key AS "testid$testid",
        Hematology_Results.result AS result,
        Hematology_Results.resultOORIndicator AS resultOORIndicator,
        Hematology_Results.units AS units,
        Hematology_Results.unitsMVIndicator AS unitsMVIndicator,
        Hematology_Results.qualresult AS qualresult,
        Hematology_Results.Remark AS Remark,
        Hematology_Results$RefRange$.AgeAtTime AS RefRange_ageAtTime,
        Hematology_Results$RefRange$.ref_range_min AS RefRange_ref_range_min,
        Hematology_Results$RefRange$.ref_range_max AS RefRange_ref_range_max,
        Hematology_Results$RefRange$.status AS RefRange_status,
        Hematology_Results.lsid AS lsid
        FROM studydataset.c108_hematologyresults Hematology_Results
            LEFT OUTER JOIN (SELECT * FROM exp.indexvarchar WHERE ((listid = 1235))) AS Hematology_Results$testid$ ON (Hematology_Results.testid = Hematology_Results$testid$.key)
            LEFT OUTER JOIN (
        -- <QuerySelect@3685603 name='study.hematologyRefRange'>
            -- | /*
            -- | * Copyright (c) 2010 LabKey Corporation
            -- | *
            -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
            -- | */
            -- | SELECT
            -- | c.lsid,
            -- | c.id.species.species as species,
            -- | c.id.ageclass.ageClass as ageClass,
            -- | c.id.dataset.demographics.gender as gender,
            -- | c.testId,
            -- | c.AgeAtTime,
            -- | r.ref_range_min,
            -- | r.ref_range_max,
            -- | (round(r.ref_range_min, 1) || '-' || round(r.ref_range_max, 1)) as range,
            -- | CASE
            -- | WHEN r.ref_range_max IS NULL or r.ref_range_min IS NULL
            -- | THEN null
            -- | WHEN c.result is NULL
            -- | THEN null
            -- | WHEN convert(c.result, double) >= r.ref_range_min AND convert(c.result, double) <= r.ref_range_max
            -- | THEN 'Normal'
            -- | WHEN convert(c.result, double) < r.ref_range_min
            -- | THEN 'Low'
            -- | WHEN convert(c.result, double) > r.ref_range_max
            -- | THEN 'High'
            -- | END as status
            -- | FROM (
            -- | SELECT
            -- | c.lsid,
            -- | c.testId,
            -- | c.result,
            -- | c.id,
            -- | CASE
            -- | WHEN c.id.dataset.demographics.birth is null or c.date is null
            -- | THEN null
            -- | ELSE
            -- | ROUND(CONVERT(age_in_months(c.id.dataset.demographics.birth, c.date), DOUBLE) / 12, 1)
            -- | END as AgeAtTime
            -- | FROM hematologyResults c
            -- | ) c
            -- | LEFT JOIN lists.ageclass ac
            -- | ON (
            -- | c.ageAtTime IS NOT NULL AND
            -- | c.ageAtTime >= ac."min" AND
            -- | (c.ageAtTime <= ac."max" OR ac."max" is null) AND
            -- | c.id.Species.species = ac.species
            -- | )
            -- | LEFT JOIN lists.lab_test_range r ON (
            -- | c.testId = r.test AND
            -- | c.id.species.species = r.species AND
            -- | c.id.ageclass.ageClass = r.age_class AND
            -- | c.id.dataset.demographics.gender = r.gender
            -- | )
            SELECT c_3.lsid AS lsid,
            c_3.Id_Species_species AS species,
            c_3.Id_AgeClass_AgeClass AS ageClass,
            c_3.Demographics_gender AS gender,
            c_3.testId AS testId,
            c_3.AgeAtTime AS AgeAtTime,
            r_5.ref_range_min AS ref_range_min,
            r_5.ref_range_max AS ref_range_max,
            {fn round((r_5.ref_range_min)*10.0)}/10.0||'-'||{fn round((r_5.ref_range_max)*10.0)}/10.0 AS range,
             CASE
            WHEN(r_5.ref_range_max IS NULL OR r_5.ref_range_min IS NULL)THEN(NULL)
            WHEN(c_3.result IS NULL)THEN(NULL)
            WHEN(CAST(c_3.result AS DOUBLE PRECISION)>=r_5.ref_range_min AND CAST(c_3.result AS DOUBLE PRECISION)<=r_5.ref_range_max)THEN('Normal')
            WHEN(CAST(c_3.result AS DOUBLE PRECISION)<r_5.ref_range_min)THEN('Low')
            WHEN(CAST(c_3.result AS DOUBLE PRECISION)>r_5.ref_range_max)THEN('High')
            END AS status
            FROM (
            -- <QuerySelect@13152602>
                -- | /*
                -- | * Copyright (c) 2010 LabKey Corporation
                -- | *
                -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
                -- | */
                -- | SELECT
                -- | c.lsid,
                -- | c.id.species.species as species,
                -- | c.id.ageclass.ageClass as ageClass,
                -- | c.id.dataset.demographics.gender as gender,
                -- | c.testId,
                -- | c.AgeAtTime,
                -- | r.ref_range_min,
                -- | r.ref_range_max,
                -- | (round(r.ref_range_min, 1) || '-' || round(r.ref_range_max, 1)) as range,
                -- | CASE
                -- | WHEN r.ref_range_max IS NULL or r.ref_range_min IS NULL
                -- | THEN null
                -- | WHEN c.result is NULL
                -- | THEN null
                -- | WHEN convert(c.result, double) >= r.ref_range_min AND convert(c.result, double) <= r.ref_range_max
                -- | THEN 'Normal'
                -- | WHEN convert(c.result, double) < r.ref_range_min
                -- | THEN 'Low'
                -- | WHEN convert(c.result, double) > r.ref_range_max
                -- | THEN 'High'
                -- | END as status
                -- | FROM (
                -- | SELECT
                -- | c.lsid,
                -- | c.testId,
                -- | c.result,
                -- | c.id,
                -- | CASE
                -- | WHEN c.id.dataset.demographics.birth is null or c.date is null
                -- | THEN null
                -- | ELSE
                -- | ROUND(CONVERT(age_in_months(c.id.dataset.demographics.birth, c.date), DOUBLE) / 12, 1)
                -- | END as AgeAtTime
                -- | FROM hematologyResults c
                -- | ) c
                -- | LEFT JOIN lists.ageclass ac
                -- | ON (
                -- | c.ageAtTime IS NOT NULL AND
                -- | c.ageAtTime >= ac."min" AND
                -- | (c.ageAtTime <= ac."max" OR ac."max" is null) AND
                -- | c.id.Species.species = ac.species
                -- | )
                -- | LEFT JOIN lists.lab_test_range r ON (
                -- | c.testId = r.test AND
                -- | c.id.species.species = r.species AND
                -- | c.id.ageclass.ageClass = r.age_class AND
                -- | c.id.dataset.demographics.gender = r.gender
                -- | )
                SELECT c_2.lsid AS lsid,
                c_2.testid AS testId,
                c_2.result AS result,
                c_2.Id AS id,
                 CASE
                WHEN(c_2.Demographics_birth IS NULL OR c_2.Date IS NULL)THEN(NULL)
                ELSE ({fn round((CAST((CASE WHEN ({fn dayofmonth(c_2.Demographics_birth)}>{fn dayofmonth(c_2.Date)}) THEN (12*({fn year(c_2.Date)}-{fn year(c_2.Demographics_birth)})+{fn month(c_2.Date)}-{fn month(c_2.Demographics_birth)}-1) ELSE (12*({fn year(c_2.Date)}-{fn year(c_2.Demographics_birth)})+{fn month(c_2.Date)}-{fn month(c_2.Demographics_birth)}) END) AS DOUBLE PRECISION)/12)*10.0)}/10.0)
                END AS AgeAtTime,
                c_2.Id_Species AS Id_Species,
                c_2.Id_Species_species AS Id_Species_species,
                c_2.Id_AgeClass AS Id_AgeClass,
                c_2.Id_AgeClass_AgeClass AS Id_AgeClass_AgeClass,
                c_2.Id_DataSet AS Id_DataSet,
                c_2.Demographics AS Demographics,
                c_2.Demographics_gender AS Demographics_gender
                FROM (
                -- <QueryTable@14909357 savedName='studydataset.c108_hematologyresults' name='Hematology Results' class='DataSetTable'>
                    SELECT studydataset_c108_hematologyresults_6.Date AS Date, studydataset_c108_hematologyresults_6.Id AS Id, studydataset_c108_hematologyresults_6$Id$.participantid AS Id_AgeClass, studydataset_c108_hematologyresults_6$Id$AgeClass$.AgeClass AS Id_AgeClass_AgeClass, studydataset_c108_hematologyresults_6$Id$.participantid AS Id_DataSet, studydataset_c108_hematologyresults_6$Id$.participantid AS Demographics, studydataset_c108_hematologyresults_6$Demographics$.birth AS Demographics_birth, studydataset_c108_hematologyresults_6$Demographics$.gender AS Demographics_gender, studydataset_c108_hematologyresults_6$Id$.participantid AS Id_Species, studydataset_c108_hematologyresults_6$Id$Species$.species AS Id_Species_species, studydataset_c108_hematologyresults_6.lsid AS lsid, studydataset_c108_hematologyresults_6.result AS result, studydataset_c108_hematologyresults_6.testid AS testid
                    FROM studydataset.c108_hematologyresults AS studydataset_c108_hematologyresults_6
                        LEFT OUTER JOIN (SELECT * FROM study.participant WHERE (container IN (?))) AS studydataset_c108_hematologyresults_6$Id$ ON (studydataset_c108_hematologyresults_6.Id = studydataset_c108_hematologyresults_6$Id$.participantid)
                        LEFT OUTER JOIN (
                    -- <QuerySelect@32843116 name='study.demographicsAgeClass'>
                        -- | /*
                        -- | * Copyright (c) 2010 LabKey Corporation
                        -- | *
                        -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
                        -- | */
                        -- | SELECT
                        -- | d.id,
                        -- | ac.AgeClass,
                        -- | --ac.dataset,
                        -- | FROM study.Demographics d
                        -- | LEFT JOIN lists.ageclass ac
                        -- | ON (
                        -- | d.id.age.ageInYears IS NOT NULL AND
                        -- | d.id.age.ageInYears >= ac."min" AND
                        -- | (d.id.age.ageInYears <= ac."max" OR ac."max" is null) AND
                        -- | d.id.Species.species = ac.species
                        -- | )
                        SELECT d_2.Id AS id,
                        ac_3.ageclass AS AgeClass
                        FROM (
                        -- <QueryTable@15053279 savedName='studydataset.c108_demographics' name='Demographics' class='DataSetTable'>
                            SELECT studydataset_c108_demographics_4.Id AS Id, studydataset_c108_demographics_4$Id$.participantid AS Id_Species, studydataset_c108_demographics_4$Id$Species$.species AS Id_Species_species, studydataset_c108_demographics_4$Id$.participantid AS Id_Age, studydataset_c108_demographics_4$Id$Age$.AgeInYears AS Id_Age_AgeInYears, studydataset_c108_demographics_4.lsid AS lsid
                            FROM studydataset.c108_demographics AS studydataset_c108_demographics_4
                                LEFT OUTER JOIN (SELECT * FROM study.participant WHERE (container IN (?))) AS studydataset_c108_demographics_4$Id$ ON (studydataset_c108_demographics_4.Id = studydataset_c108_demographics_4$Id$.participantid)
                                LEFT OUTER JOIN (
                            -- <QuerySelect@3019819 name='study.demographicsSpecies'>
                                -- | /*
                                -- | * Copyright (c) 2010 LabKey Corporation
                                -- | *
                                -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
                                -- | */
                                -- | SELECT
                                -- | d.Id AS Id,
                                -- | CASE
                                -- | WHEN(d.Id like 'r%')THEN('Rhesus')
                                -- | WHEN(d.Id like 'cy%')THEN('Cynomolgus')
                                -- | WHEN(d.Id like 'cj%')THEN('Marmoset')
                                -- | WHEN(d.Id like 'm%')THEN('Marmoset')
                                -- | WHEN(d.Id like 'tx%')THEN('Marmoset')
                                -- | WHEN(d.Id like 'ag%')THEN('Vervet')
                                -- | WHEN(d.Id like 'so%')THEN('Cotton-top Tamarin')
                                -- | WHEN(d.Id like 'st%')THEN('Stump Tailed')
                                -- | ELSE 'Unknown'
                                -- | END AS species,
                                -- | FROM study.Demographics d
                                -- | -- LEFT JOIN lists.species s ON (d.id ~* s.prefix)
                                SELECT d_2.Id AS Id,
                                 CASE
                                WHEN(d_2.Id LIKE 'r%')THEN('Rhesus')
                                WHEN(d_2.Id LIKE 'cy%')THEN('Cynomolgus')
                                WHEN(d_2.Id LIKE 'cj%')THEN('Marmoset')
                                WHEN(d_2.Id LIKE 'm%')THEN('Marmoset')
                                WHEN(d_2.Id LIKE 'tx%')THEN('Marmoset')
                                WHEN(d_2.Id LIKE 'ag%')THEN('Vervet')
                                WHEN(d_2.Id LIKE 'so%')THEN('Cotton-top Tamarin')
                                WHEN(d_2.Id LIKE 'st%')THEN('Stump Tailed')
                                ELSE ('Unknown')
                                END AS species
                                FROM (
                                -- <QueryTable@21555752 savedName='studydataset.c108_demographics' name='Demographics' class='DataSetTable'>
                                    SELECT studydataset_c108_demographics_3.Id AS Id, studydataset_c108_demographics_3.lsid AS lsid
                                    FROM studydataset.c108_demographics AS studydataset_c108_demographics_3
                                -- </QueryTable@21555752>
                                ) d_2
                            -- </QuerySelect@3019819>
                            ) AS studydataset_c108_demographics_4$Id$Species$ ON (studydataset_c108_demographics_4$Id$.participantid = studydataset_c108_demographics_4$Id$Species$.Id)
                                LEFT OUTER JOIN (
                            -- <QuerySelect@8896621 name='study.demographicsAge'>
                                -- | /*
                                -- | * Copyright (c) 2010 LabKey Corporation
                                -- | *
                                -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
                                -- | */
                                -- | SELECT
                                -- | d.id,
                                -- | d.birth,
                                -- | --CONVERT(age(d.birth, COALESCE(d.death, curdate())), INTEGER) AS "AgeInYearsRounded",
                                -- | floor(age(d.birth, COALESCE(d.death, curdate()))) AS "AgeInYearsRounded",
                                -- | CONVERT(age_in_months(d.birth, COALESCE(d.death, curdate())), INTEGER) AS "AgeInMonths",
                                -- | ROUND(CONVERT(age_in_months(d.birth, COALESCE(d.death, curdate())), DOUBLE) / 12, 1) AS "AgeInYears",
                                -- | FROM study.Demographics d
                                SELECT d_2.Id AS id,
                                d_2.birth AS birth,
                                {fn floor((CASE WHEN ({fn month(d_2.birth)}>{fn month(coalesce(d_2.death,{fn curdate()}))} OR {fn month(d_2.birth)}={fn month(coalesce(d_2.death,{fn curdate()}))} AND {fn dayofmonth(d_2.birth)}>{fn dayofmonth(coalesce(d_2.death,{fn curdate()}))}) THEN ({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)}-1) ELSE ({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)}) END))} AS AgeInYearsRounded,
                                CAST((CASE WHEN ({fn dayofmonth(d_2.birth)}>{fn dayofmonth(coalesce(d_2.death,{fn curdate()}))}) THEN (12*({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)})+{fn month(coalesce(d_2.death,{fn curdate()}))}-{fn month(d_2.birth)}-1) ELSE (12*({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)})+{fn month(coalesce(d_2.death,{fn curdate()}))}-{fn month(d_2.birth)}) END) AS INTEGER) AS AgeInMonths,
                                {fn round((CAST((CASE WHEN ({fn dayofmonth(d_2.birth)}>{fn dayofmonth(coalesce(d_2.death,{fn curdate()}))}) THEN (12*({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)})+{fn month(coalesce(d_2.death,{fn curdate()}))}-{fn month(d_2.birth)}-1) ELSE (12*({fn year(coalesce(d_2.death,{fn curdate()}))}-{fn year(d_2.birth)})+{fn month(coalesce(d_2.death,{fn curdate()}))}-{fn month(d_2.birth)}) END) AS DOUBLE PRECISION)/12)*10.0)}/10.0 AS AgeInYears
                                FROM (
                                -- <QueryTable@9985211 savedName='studydataset.c108_demographics' name='Demographics' class='DataSetTable'>
                                    SELECT studydataset_c108_demographics_3.birth AS birth, studydataset_c108_demographics_3.death AS death, studydataset_c108_demographics_3.Id AS Id, studydataset_c108_demographics_3.lsid AS lsid
                                    FROM studydataset.c108_demographics AS studydataset_c108_demographics_3
                                -- </QueryTable@9985211>
                                ) d_2
                            -- </QuerySelect@8896621>
                            ) AS studydataset_c108_demographics_4$Id$Age$ ON (studydataset_c108_demographics_4$Id$.participantid = studydataset_c108_demographics_4$Id$Age$.id)
                        -- </QueryTable@15053279>
                        ) d_2
                        LEFT JOIN (
                        -- <QueryTable@8735258 name='ageclass' class='ListTable'>
                            SELECT
                            CAST((SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7473 AND exp.ObjectProperty.ObjectId = ageclass_5.objectid) AS INT)
                             AS ageclass, ageclass_5.key AS key,
                            (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7475 AND exp.ObjectProperty.ObjectId = ageclass_5.objectid)
                             AS max,
                            (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7474 AND exp.ObjectProperty.ObjectId = ageclass_5.objectid)
                             AS min,
                            CAST((SELECT StringValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7472 AND exp.ObjectProperty.ObjectId = ageclass_5.objectid) AS VARCHAR(4000))
                             AS species
                            FROM (
                            SELECT * FROM exp.indexinteger WHERE ((listid = 1258))) ageclass_5
                        -- </QueryTable@8735258>
                        ) ac_3 ON d_2.Id_Age_AgeInYears IS NOT NULL AND d_2.Id_Age_AgeInYears>=ac_3.min AND (d_2.Id_Age_AgeInYears<=ac_3.max OR ac_3.max IS NULL) AND d_2.Id_Species_species=ac_3.species
                    -- </QuerySelect@32843116>
                    ) AS studydataset_c108_hematologyresults_6$Id$AgeClass$ ON (studydataset_c108_hematologyresults_6$Id$.participantid = studydataset_c108_hematologyresults_6$Id$AgeClass$.id)
                        LEFT OUTER JOIN studydataset.c108_demographics AS studydataset_c108_hematologyresults_6$Demographics$ ON (studydataset_c108_hematologyresults_6$Id$.participantid = studydataset_c108_hematologyresults_6$Demographics$.Id)
                        LEFT OUTER JOIN (
                    -- <QuerySelect@11025560 name='study.demographicsSpecies'>
                        -- | /*
                        -- | * Copyright (c) 2010 LabKey Corporation
                        -- | *
                        -- | * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
                        -- | */
                        -- | SELECT
                        -- | d.Id AS Id,
                        -- | CASE
                        -- | WHEN(d.Id like 'r%')THEN('Rhesus')
                        -- | WHEN(d.Id like 'cy%')THEN('Cynomolgus')
                        -- | WHEN(d.Id like 'cj%')THEN('Marmoset')
                        -- | WHEN(d.Id like 'm%')THEN('Marmoset')
                        -- | WHEN(d.Id like 'tx%')THEN('Marmoset')
                        -- | WHEN(d.Id like 'ag%')THEN('Vervet')
                        -- | WHEN(d.Id like 'so%')THEN('Cotton-top Tamarin')
                        -- | WHEN(d.Id like 'st%')THEN('Stump Tailed')
                        -- | ELSE 'Unknown'
                        -- | END AS species,
                        -- | FROM study.Demographics d
                        -- | -- LEFT JOIN lists.species s ON (d.id ~* s.prefix)
                        SELECT d_2.Id AS Id,
                         CASE
                        WHEN(d_2.Id LIKE 'r%')THEN('Rhesus')
                        WHEN(d_2.Id LIKE 'cy%')THEN('Cynomolgus')
                        WHEN(d_2.Id LIKE 'cj%')THEN('Marmoset')
                        WHEN(d_2.Id LIKE 'm%')THEN('Marmoset')
                        WHEN(d_2.Id LIKE 'tx%')THEN('Marmoset')
                        WHEN(d_2.Id LIKE 'ag%')THEN('Vervet')
                        WHEN(d_2.Id LIKE 'so%')THEN('Cotton-top Tamarin')
                        WHEN(d_2.Id LIKE 'st%')THEN('Stump Tailed')
                        ELSE ('Unknown')
                        END AS species
                        FROM (
                        -- <QueryTable@18350249 savedName='studydataset.c108_demographics' name='Demographics' class='DataSetTable'>
                            SELECT studydataset_c108_demographics_3.Id AS Id, studydataset_c108_demographics_3.lsid AS lsid
                            FROM studydataset.c108_demographics AS studydataset_c108_demographics_3
                        -- </QueryTable@18350249>
                        ) d_2
                    -- </QuerySelect@11025560>
                    ) AS studydataset_c108_hematologyresults_6$Id$Species$ ON (studydataset_c108_hematologyresults_6$Id$.participantid = studydataset_c108_hematologyresults_6$Id$Species$.Id)
                -- </QueryTable@14909357>
                ) c_2
            -- </QuerySelect@13152602>
            ) c_3
            LEFT JOIN (
            -- <QueryTable@7152527 name='ageclass' class='ListTable'>
                SELECT ageclass_7.key AS key,
                (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7475 AND exp.ObjectProperty.ObjectId = ageclass_7.objectid)
                 AS max,
                (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7474 AND exp.ObjectProperty.ObjectId = ageclass_7.objectid)
                 AS min,
                CAST((SELECT StringValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7472 AND exp.ObjectProperty.ObjectId = ageclass_7.objectid) AS VARCHAR(4000))
                 AS species
                FROM (
                SELECT * FROM exp.indexinteger WHERE ((listid = 1258))) ageclass_7
            -- </QueryTable@7152527>
            ) ac_4 ON c_3.AgeAtTime IS NOT NULL AND c_3.AgeAtTime>=ac_4.min AND (c_3.AgeAtTime<=ac_4.max OR ac_4.max IS NULL) AND c_3.Id_Species_species=ac_4.species
            LEFT JOIN (
            -- <QueryTable@25211612 name='lab_test_range' class='ListTable'>
                SELECT lab_test_range_8.key AS Key,
                CAST((SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7549 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid) AS INT)
                 AS age_class,
                CAST((SELECT StringValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7548 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid) AS VARCHAR(4000))
                 AS gender,
                (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7551 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid)
                 AS ref_range_max,
                (SELECT FloatValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7550 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid)
                 AS ref_range_min,
                CAST((SELECT StringValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7547 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid) AS VARCHAR(4000))
                 AS species,
                CAST((SELECT StringValue FROM exp.ObjectProperty WHERE exp.ObjectProperty.PropertyId = 7546 AND exp.ObjectProperty.ObjectId = lab_test_range_8.objectid) AS VARCHAR(4000))
                 AS test
                FROM (
                SELECT * FROM exp.indexinteger WHERE ((listid = 1262))) lab_test_range_8
            -- </QueryTable@25211612>
            ) r_5 ON c_3.testId=r_5.test AND c_3.Id_Species_species=r_5.species AND c_3.Id_AgeClass_AgeClass=r_5.age_class AND c_3.Demographics_gender=r_5.gender
        -- </QuerySelect@3685603>
        ) AS Hematology_Results$RefRange$ ON (Hematology_Results.lsid = Hematology_Results$RefRange$.lsid)) x
        WHERE (Id IN (?))
        ORDER BY Id ASC, Date DESC
        LIMIT 101
    -- </QueryServiceImpl.getSelectSQL()>
    ?[1] 29e3860b-02b5-102d-b524-493dbd27b599
    ?[2] 29e3860b-02b5-102d-b524-493dbd27b599
    ?[3] r95061

    org.labkey.api.data.Table$2.call(Table.java:1398)
    org.labkey.api.data.Table$2.call(Table.java:1395)
    org.labkey.api.data.AsyncQueryRequest$1.run(AsyncQueryRequest.java:69)
    java.lang.Thread.run(Thread.java:619)
 
 
Ben Bimber responded:  2010-08-27 06:28
for what it's worth, this query involves the join between a dataset and a query. i can load it fine by itself though the schema browser or as a dataset.
 
jeckels responded:  2010-08-27 14:34
Hi Ben,

ExtJS has a default 30 second timeout for all of the AJAX request that you make through its APIs. After 30 seconds, it kills the connection, which usually shows an error dialog in the client. The server also notices that the browser connection is closed and cancels the query since there's nobody to send it to anymore, so you get that exception in the log. We should probably filter them out since it's not really an error, it just means that the browser disconnected.

You can use the Ext.Ajax.timeout to control how long it waits to give up on the connection. I believe you can disable the timeout completely by setting it to 0.

Thanks,
Josh
 
Ben Bimber responded:  2010-08-28 10:58
hi josh,

thanks for the reply. if you see the javascript code snip above with me QWP config, I believe I am already setting 'timeout: 0'. Isnt this QWP option supposed to do exactly what you suggest? that's what was throwing me off.
 
jeckels responded:  2010-08-30 10:00
Hi Ben,

Sorry I missed that in your code snippet.

After more investigation, it's not as easy to disable timeouts as I thought. There's a bug in LABKEY.QueryWebPart that treats a timeout value of 0 the same as if you didn't set one at all. I'll fix that for 10.3.

Then there's the Ext.Ajax.request() timeout implementation, which seems to have a similar bug. It treats a timeout value of 0 as an indication that it should use the static timeout value stored on Ext.Ajax.timeout.

So, to truly disable timeouts you'd need the LABKEY.QueryWebPart fix, and in your code set timeout to 0 on the QueryWebPart config option (like you are), AND set the Ext.Ajax.timeout value to 0.

So, for now I'd recommend just setting a very large timeout value.

Thanks,
Josh
 
Ben Bimber responded:  2010-08-30 10:14
ok, i will do that. thanks for following up.
 
Ben Bimber responded:  2010-08-30 10:31
josh - while we're on the subject, shouldnt errorCallback be thrown when a QWP times out, rather than successCallback? seems like more of an error than a success.
 
jeckels responded:  2010-08-30 13:07
Hi Ben,

Yes. In my test case, that's the behavior I'm seeing.

What file and line is that error message in the console coming from?

Thanks,
Josh
 
Ben Bimber responded:  2010-08-30 15:48
hi josh,

i just checked in a change to the trunk. see animal_history.js, ~line 525. that code loads a QWP. if you have a copy of the EHR data, load the page 'animal history', then run the hematology report on r95061. hopefully you have a recent enough DB dump to have that report in there correctly.

when that report times out, it's actually called successCallback instead of errorCallback. If you look at the console in firebug, you can either throw a breakpoint or watch the console. it will log a message when it either runs successCallback or errorCallback.