Tiny bug in processing empty query results in GUI

  • Dear Marcel,

    One of my colleagues pointed me to some LUA runtime errors he saw in serverstatus.log, for our clinical server.

    I looked into it and he meant the following error:

    [CONQUESTSRV1] *** lua run error [string "local first=true; local ae=[[DICOMHOST]];..."]:1: attempt to index field '?' (a nil value) in 'local first=true; local ae=[[DICOMHOST]];local level=[[PATIENT]];local q={QueryRetrieveLevel=[[PATIENT]],PatientID=[[1*]],PatientName=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do if type(v)~="table" then keys[#keys+1]=k end end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.." ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do for k2,v2 in ipairs(keys) do f:write("["..v[v2].."] ") end f:write("\n") end returnfile=s f:close();'

    I had seen this error before, and know it comes up when a user performs a DICOM query in the Conquest GUI for which the (local or remote) queried server has no results. It does not appear to be problematic, it only appears in serverstatus.log, conquestdicomserver.log and PacsTrouble.log, but it did worry my colleague :)

    I think I have traced it back to LUA code in "Serverdriver.pas", procedure TForm1.QueryButtonClick(). I think the LUA code is trying to index and parse fields from rows that are not present when the queryresult is empty. The error does not appear when the query-result contains at least one record. Is this indeed a "tiny bug"? I see this behaviour in Conquest 1.5.0b and 1.5.0e alike. I think it is a common issue, so apologies if this has been reported before.

    Steps to reproduce:

    1) Install Conquest (SQLite database, create tables, hostname, et cetera)

    2) Open the GUI

    3) Query the local or a remote DICOM system on a data-item you know is not there (non-existing patientID, for example)

    4) Look on "Server status" tab for last entries in serverstatus.log, or open serverstatus.log, conquestdicomserver.log or PacsTrouble.log.

    Kind regards, and keep up the good work!

    Maarten Buiter

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!