Random Error when querying the web server

  • Hi,

    I came across the below error which is quite infrequent and sporadic when I query the web server. Not sure why this occurs.

    Could you please guide me on how to debug this? Not familiar with Lua. Thanks.

  • Hi,

    I am not sure why this happens and have not seen this before. The lua script in line 11 calls a dicomget that fails with the message in line 1. I guess it works on the next attempt? What OS are you using?

    Marcel

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • marcelvanherk

    This intermittent keeps popping up when quering CQ's webserver (using Windows OS):

    PHP
    09/03/2026 09:35:12 [MYNODE0] ***No valid presentation contexts/transfer syntax found in 0 candidates
    09/03/2026 09:35:12 [MYNODE0] ***In 1 presentation contexts
    09/03/2026 09:35:12 [MYNODE0] ***#Possible transfer syntaxes: 1
    09/03/2026 09:35:12 [MYNODE0] ***No accepted presentation contexts/transfer syntax found in 1 candidates
    09/03/2026 09:35:12 [MYNODE0] *** lua run error [string "  local ae='MYNODE0';..."]:5: attempt to index a nil value in '  local ae='MYNODE0';   local level='IMAGE';   local dicomweb=true;   local q2=DicomObject:new(' {"00280008":"","00280100":"","00280011":"","00280010":"","00200013":"","00081190":"","00080201":"","00080056":"","00080018":"","00080016":"","StudyInstanceUID":"<UID>","SeriesInstanceUID":"<UID>","99990C00":"ImageNumber"} ');   local r = dicomquery(ae, level, q2):Serialize(true,true,dicomweb);   local s=tempfile('.txt') local f=io.open(s, "wb") f:write(r) returnfile=s f:close(); '
    09/03/2026 09:35:12 [MYNODE0] *** multiplex: connection terminated

    Typically happens with dicomquery & dicomget. I did a retry mechanism in my Node.js code: it would retry thrice with a delay of 2 seconds each. But sometimes they fail consistently even with retries, and they are very random and intermittent.

    Is there any way to sort this out effectively? Thanks.

    Edited once, last by SM1312 (March 10, 2026 at 2:25 PM).

  • Hm,

    are the presentation context messages part of the same error? In which case dicomquery seems to send a malformed request and gets nil back as result.

    you may try to add some logging to qido.php?

    Marcel

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • marcelvanherk

    TBH I do see the presentation context messages whenever the above dicomquery & dicomget lua error occur.

    If its malformed, why does it work on retries without any change in the query or its params?! Because its random, I can't reproduce it properly which is another issue.

  • Hi,

    Could you maybe capture the query command that gives an error (servertask.exe with parameters), and loop it in a batch file to see what happens? Maybe there is interference when multiple run at once (which of course should not be the case)

    Marcel

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • marcelvanherk

    Typically this happens when I build a hierarchy for a study by quering the following, but I don't call servertask directly, I use the webserver.

    • I query all the series with a study by calling /api/dicom/rs/studies/${studyUID}/series
    • Then for each series inside the study, I call /api/dicom/rs/studies/${studyUID}/series/${seriesUID}/instances
    • Then for the series instance (if CT, I take the first instance), I call /api/dicom/rs/studies/${studyUID}/series/${seriesUID}/instances/${instanceUID}/metadata

    Basically, I create a custom hierarchical object which follows the below format in JS code (my own wrapper around CQ webserver):

    Mostly, I face this lua error especially during such querying.
    Is this what you wanted?

  • Hi, I understood that as such. I was wondering if you could isolate the call from qido.php that throws the error and then call it many times looking for a pattern

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • marcelvanherk

    Sorry for the delay. But its concurrency issue.

    I tried the above launching 10 concurrent querying. Consistently 3 or 4 of those iterations failed with the lua error.
    I repeated the same without any concurrency and they were all fine.

  • marcelvanherk

    Here are some of the logs while I was testing.

    Based on my testing, potential error triggers:

    1. DICOM ERROR connect failed on socket level (called not running) — Conquest's internal DICOM service can't handle the concurrent connections, so the socket-level call fails.
    2. servercommand('get_param:MyACRNema') returns nil — because in rquery.lua, lines like local ae = server or servercommand('get_param:MyACRNema') fall back to servercommand, but when the server is overloaded, that command itself fails and returns nil.
    3. attempt to concatenate local 'ae' (a nil value) — the nil ae then gets string-concatenated into the remote code block and crashes.
    4. dicomget or dicomquery itself fails due to concurrency.

    Edited once, last by SM1312 (March 19, 2026 at 9:04 PM).

  • marcelvanherk

    In addition to the above log and debug details, I also ran a small benchmarking test.

    Basically I tested the Conquest node against a repeated no. of queries (the JS querying code I specified here) by creating a wrapper in JS with a semaphore which limits the concurrency.


    In the above, limit is the concurrency restriction I placed in the wrapper for querying. It starts from a single process to 10 concurrent process.
    Since the error was intermittent, I did three runs for each of the limits.

    Not sure whether this would be of any help to you.

  • Hi,

    Thanks for your tests. Can you still share more of the log (with high level debug logging) just prior to the first error? You can also edit rquery.lua and insert a few print statements. Have tried to reproduce from lua but no luck yet.

    Marcel

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

    Edited once, last by marcelvanherk (March 20, 2026 at 10:28 AM).

  • marcelvanherk

    I tried adding some print in rquery.lua

    At the Conquest side in serverstatus.log, I get:

    My finding: ae is nil before remotequery is even called. Looking at the log sequence:

    Code
    rquery: ae=nil, level=SERIES          ← rquery gets nil from servercommand
    remotequery: ae=nil, level=SERIES     ← passes nil to remotequery

    I suppose servercommand('get_param:MyACRNema') returns nil when the server is busy handling multiple DICOM threads.
    I think the nil ae then cascades into either concatenation errors or DICOM socket errors depending on timing

    Is this helpful or do you need anything more specific? Thanks

  • Hi,

    the issue is in get_param, and I can reproduce it with this script:

    for i=1,1000 do servercommand("luastart:system('servertask.exe --luastart:sleep(math.random(100));dofile([[a.lua]])')") end

    a.lua:

    Code
    sleep(math.random(1000))
    -- s = servercommand('lua:return 1') -- this works fine concurrently
    s = servercommand('get_param:MyACRNema') -- this return nil when run concurrenltly
    print(s)

    Will try to further locate the issue later.

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

Participate now!

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