Posts by SM1312

    marcelvanherk

    I noticed the below bug with the FileNameSyntax in dicom.ini.

    If the FileNameSyntax is %id\%studydate\%modality_%seriesuid\%modality_%imagenum_%sopuid.dcm, while the images are written, the UIDs in the filename are truncated:

    Code
    13/10/2026 13:06:22 [MSNODE0] Written file: D:\Conquest\Data\SABROLIGO0001\20250124\CT_1.2.826.0.1.3680043.2.135.738998.62915475.7.1749459043.109.10\CT_2_1.2.826.dcm
    13/10/2026 13:06:22 [MSNODE0] Written file: D:\Conquest\Data\SABROLIGO0001\20250124\CT_1.2.826.0.1.3680043.2.135.738998.62915475.7.1749459043.109.10\CT_3_1.2.826.dcm
    13/10/2026 13:06:23 [MSNODE0] Written file: D:\Conquest\Data\SABROLIGO0001\20250124\CT_1.2.826.0.1.3680043.2.135.738998.62915475.7.1749459043.109.10\CT_4_1.2.826.dcm

    Instead of using %sopuid, if I use %V0008,0018, then its fine (.s are replaced with _). Not sure if its a regression or not though!
    Thanks.

    Kind regards,
    Mahesh

    marcelvanherk If it helps, I tried looking through the code. I think the issue is in src/dgate/src/dbsql.cpp with MakeSafeStringValues() (around line 2719). Bringing back the per-type conversion before it falls back to GetString should solve it I guess:

    An inline switch with sprintf("%u", ...) for each type, copied from the old SetString, would work just as well.

    An unrelated second bug in VR::GetString: when the value is too long, it writes buf[max]=0, one byte past the end of the buffer. It should be strncpy(buf, Data, max-1); buf[max-1]=0;. I think this can corrupt memory.

    I think this would be the fix. you can check it yourself as I am not too familiar with C++.

    Hi marcelvanherk

    I have this issue with 1.5.0g/g2. dicom.sql hasn't been changed but v1.5.0f didn't have the issue.

    Code
    20261012 11:04:27 Inconsistent StudyModal in DICOMStudies: PatientID = 'xxRS_PelvisHFS' StudyInsta = '1.2.392.200036.9116.2.6.1.3268.2056548474.1767409376.39617', Old='CT', New='RTSTRUCT\\CT'
    20261012 11:04:27 Inconsistent StudyModal in DICOMStudies: PatientID = 'xxRS_PelvisHFS' StudyInsta = '1.2.392.200036.9116.2.6.1.3268.2056548474.1767409376.39617', Old='RTSTRUCT\\CT', New='RTPLAN\\RTSTRUCT\\CT'
    20261012 11:04:27 ***Failed MYSQLExec : INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, NumberOfFr, SamplesPer, PhotoMetri, QRows, QColumns, BitsStored, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.752.243.1.1.20260204180840947.1810.58500', '1.2.840.10008.5.1.4.1.1.481.2', '1', '20260204', '180840.000000', '103', '', 'MONOCHROME2', 'Œ', '', '', 'xxRS_PelvisHFS', '1.2.752.243.1.1.20260204180840947.1810.58500.1', 1791799456, 'xxRS_PelvisHFS\\20260103\\RTDOSE_1.2.752.243.1.1.20260204180840947.1810.58500.1\\RTDOSE_1_1_2_752_243_1_1_20260204180840947_1810_58500.dcm', 'MAG0')
    20261012 11:04:27 ***Error: Incorrect string value: '\x8C' for column 'QRows' at row 1
    20261012 11:04:27 ***Unable to DB.Add()
    20261012 11:04:27 ***SQL: INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, NumberOfFr, SamplesPer, PhotoMetri, QRows, QColumns, BitsStored, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.752.243.1.1.20260204180840947.1810.58500', '1.2.840.10008.5.1.4.1.1.481.2', '1', '20260204', '180840.000000', '103', '', 'MONOCHROME2', 'Œ', '', '', 'xxRS_PelvisHFS', '1.2.752.243.1.1.20260204180840947.1810.58500.1', 1791799456, 'xxRS_PelvisHFS\\20260103\\RTDOSE_1.2.752.243.1.1.20260204180840947.1810.58500.1\\RTDOSE_1_1_2_752_243_1_1_20260204180840947_1810_58500.dcm', 'MAG0')
    20261012 11:04:27 ***Error: Incorrect string value: '\x8C' for column 'QRows' at row 1
    20261012 11:04:27 ***Error saving to SQL: xxRS_PelvisHFS\20260103\RTDOSE_1.2.752.243.1.1.20260204180840947.1810.58500.1\RTDOSE_1_1_2_752_243_1_1_20260204180840947_1810_58500.dcm

    I am attaching the level 4 debug log serverstatus.txt. Also attached my current ini dicom.ini.txt. Is there anything I am missing in config or settings wise?

    Could you please look into this? Thanks in advance

    Kidn regards,
    Mahesh

    Hi marcelvanherk

    We noticed an issue with CT received by Conquest from Raystation which was an average intensity projection of a 4D scan. This CT has 93 slices.
    The log serverstatus.txt (debug mode) doesn't show anything obvious or error and it does seem like it received all the slices. But in the data folder of the patient, it had only one CT slice. The log does show that there is one slice being written over and over again 93 times.
    When its exported to any other system again from Conquest, it sends that one slice 93 times though.

    We deleted that one slice manually and replaced it with 93 slices into the data folder of that patient and regened the database. Now, all the 93 slices looked fine and exported fien to other systems as well.
    but "Browse database" section for the CT, we don't see any instance info in the list.

    Due to the size of the CT (93 slices), I can't attach the whole CT. But I took ten slices out of the data and attached it 4D-AverageIntensityProjection-CT_DICOMs-Sample.zip for you to help with debugging if needed.

    Thanks in advance.

    Kind regards,
    Mahesh

    marcelvanherk

    I got back to this as the issue still causes annoying failures when querying the webserver.
    This time, I used Claude as well to help with the debugging.

    Claude analysis as follows (diagonsed with the source code of v1.5.0f):

    What the log lines actually mean

    The four messages are both halves of the same failed association, which is why they look confusing:

    • No valid presentation contexts/transfer syntax found in 0 candidates — server side, pdu.cxx:483. The 0 is the total number of transfer syntaxes across all proposed presentation contexts. The incoming A-ASSOCIATE-RQ literally offered none.
    • In 1 presentation contexts — one presentation context was proposed. That matches dicomget's first association exactly: it proposes a single abstract syntax (StudyRootQuery) for the C-FIND that fetches SOP class UIDs before the actual C-GET.
    • No accepted presentation contexts/transfer syntax found in 1 candidates — SCU side, pdu.cxx:539. Same association, seen from the other end after the server returned the rejection.
    • multiplex: connection terminated — ServerChild giving up.

    PDU.Connect() then returns FALSE, luadicomget does return 0, so r is nil in Lua and r:Serialize(...) blows up. Everything downstream is a consequence.

    Root cause

    ExtendedPDU_Service overrides AddTransferSyntaxs() (nkiqrsop.cpp:5103). The last thing that function does is:

    Code
    if (strchr(RequestedCompressionType, '!')==NULL)
    { uid.Set("1.2.840.10008.1.2");    // ImplicitLittleEndian
      TrnSyntax.Set(uid);
      PresContext.AddTransferSyntax(TrnSyntax);
    }

    That is the only line that guarantees a presentation context gets at least one transfer syntax. Now the two problems:

    1. RequestedCompressionType[64] is never initialised. The ExtendedPDU_Service constructor (nkiqrsop.hpp:57) sets L, VariableVRs and ThreadNum — but not this member.
    2. luadicomget never calls SetRequestedCompressionType(). At dgate.cpp:28559 it declares ExtendedPDU_Service PDU;, reads compress out of GetACRNema()… and then never applies it. Compare luadicomstore at 28711–28712, which correctly does SetRequestedCompressionType("") followed by SetRequestedCompressionType(compress). Every other caller in the codebase (5420, 9787, 19688–19701) sets it too.

    So on every dicomget(), that 64-byte buffer holds uninitialised stack memory. Usually the garbage doesn't start with j/J, isn't ul/ub/ue, and — crucially — contains no 0x21 byte before its first NUL, so the guard passes and Implicit LE is added. It works.

    Occasionally the stack garbage happens to contain a !. The guard fails, no transfer syntax is added, and Conquest sends a presentation context with zero transfer syntaxes. That's your "0 candidates".

    That's exactly why it's sporadic, why it isn't reproducible on demand, and why an immediate retry often doesn't clear it — it depends on whatever the thread's stack happened to contain, which can persist across a retry that follows the same code path.

    luadicomquery (dgate.cpp:27792) has the identical defect. dicomecho uses a plain PDU_Service, whose base AddTransferSyntaxs unconditionally adds Implicit LE, so it's immune — which fits if you've never seen echoes fail this way.

    Claude's Recommended Fix

    Either of these; I'd do both.

    In nkiqrsop.hpp, constructor body, alongside the existing memset:

    Code
    RequestedCompressionType[0] = 0;
    AcceptedCompressionType[0]  = 0;

    And in luadicomget (dgate.cpp, right after the GetACRNema block around 28572), matching what luadicomstore does:

    Code
    PDU.SetRequestedCompressionType("");

    Use "" rather than compress unless you actually want the AE's configured compression negotiated on the retrieve — passing compress is arguably the original intent, but it changes negotiation behaviour, so keep the two changes separate.

    Two related things worth knowing

    PDU_Service::Multiplex(int) (pdu.cxx:690) deliberately no longer aborts when AAssociateRQ::Read fails — a 20131106 change swapped the return FALSE for a debug-only message. So genuine truncated reads get silently interrogated as half-parsed associations. It isn't what bit you here, but it means this class of error always presents as a negotiation failure rather than "connection lost". Related: Buffer::Read zero-fills and returns FALSE on failure, and every caller in aarq.cxx ignores that return value.

    Also PDU_Service::Close() (pdu.cxx:701) returns early without calling Link.Close() if the A-RELEASE-RP read fails, and nothing clears the inherited Buffer::Incoming queue between associations. Since luadicomget reuses one PDU object for the C-FIND and then the C-GET, that's a second, independent way for those two associations to desynchronise. Worth fixing while you're in there.

    marcelvanherk

    I don't see any obvious problem with TCP params. I did have a look at the logs in the EventViewer for TCP related things but don't see anything of problem.

    marcelvanherk

    I did a powershell equivalent for that in windows while running the 10 concurrent queries:

    Morning marcelvanherk,

    I did install 1.5.0f on Ubuntu 22.04 (this was using sqlite instead of mysql though) and tested the same 10 concurrent API queries.

    Unlike Window where there were atleast 3 or 4 failures, in Linux I saw one failure out of 10. I repeated it thrice. Out of three tries, there were 1 failure in two of them while there were none in the last. But the error was the same.

    I got the above error from PacsTrouble.log. It seems serverstatus.log doesn't seem to be updated in linux!!!

    In serverstatus.log, I only have this:

    YAML
    Tue Mar 24 10:34:50 2026 Stared zip and cleanup thread
    Tue Mar 24 10:34:50 2026 *** Not enough rights to write in MAG0
    Tue Mar 24 10:34:50 2026 Monitoring for files in: /home/itsme/conquest/data/incoming/
    Tue Mar 24 10:34:50 2026 DGATE (1.5.0f, build Tue Mar 24 09:54:00 2026, bits 64) is running as threaded server
    Tue Mar 24 10:34:50 2026 Database type: built-in SQLite driver
    Tue Mar 24 10:34:50 2026 ***Failed to Listen () - bind error

    Should I do anything more or correct something to get proper serverstatus.log!???

    Thanks.