Store SCP Erratic Failure

564 views
Skip to first unread message

bulkmai...@gmail.com

unread,
Apr 15, 2013, 10:58:47 AM4/15/13
to fo-d...@googlegroups.com
Hi,
I have attempted to implement a simple query, move example.  I believe I have done everything correctly, and indeed the example executes fine about 30% of the time.  I am experiencing erratic failures by simply re-running.  Does anyone know what is going on?
 
 
The failure takes one of two forms:
 
1) System.AccessViolationException with a message of Attempted to read or write protected memory.  This occurs after several of the files have been transferred.  I am unable to get additional information as visual studio tells me the stack is in external code.
 
2) System.NullReferenceException when processing the PDU.  This occurs prior to any files being transferred.    It looks like the error occurs during this function call SendAssociationAccept(association); in CStoreSCP.  See the log below.
 
QM-pacsd01 -> Association accept:
Calling AE Title:       AB-pacsd01
Called AE Title:        STORESCP
Implementation Class:   Implementation Class UID [1.2.40.0.13.1.1]
Implementation Version: dcm4che-1.4.29
Maximum PDU Length:     16352
Async Ops Invoked:      0
Async Ops Performed:    1
Presentation Contexts:  2
  Presentation Context:  1 [Accept]
       Abstract Syntax:  MR Image Storage
       Transfer Syntax:  Implicit VR Little Endian
  Presentation Context:  3 [Accept]
       Abstract Syntax:  MR Image Storage
       Transfer Syntax:  Explicit VR Little Endian
Exception processing PDU: System.NullReferenceException: Object reference not set to an instance of an object.
   at Dicom.Network.DicomService.SendNextPDU() in Z:\Development\fo-dicom\DICOM\Network\DicomService.cs:line 578
   at Dicom.Network.DicomService.SendPDU(PDU pdu) in Z:\Development\fo-dicom\DICOM\Network\DicomService.cs:line 557
   at Dicom.Network.DicomService.SendAssociationAccept(DicomAssociation association) in Z:\Development\fo-dicom\DICOM\Network\DicomService.cs:line 944
   at DicomClientExperiment.CStoreSCP.OnReceiveAssociationRequest(DicomAssociation association) in c:\Users\Administrator\Desktop\AB\trunk\AB\code\Dic
omClientExperiment\CStoreSCP.cs:line 76
   at Dicom.Network.DicomService.EndReadPDU(IAsyncResult result) in Z:\Development\fo-dicom\DICOM\Network\DicomService.cs:line 199
QM-pacsd01 <- C-Move response [3]: Out of Resources
                Failures:       146
C-Move response [3]: Out of Resources
                Failures:       146
QM-pacsd01 -> Association release request
QM-pacsd01 <- Association release response
 
The code is below what I am executing.
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Dicom;
using Dicom.Network;
using NLog;
using NLog.Config;
using NLog.Targets;
using Dicom.Log;

namespace DicomClientExperiment
{
    class Program
    {
        public static void MoveDelegate(DicomCMoveRequest request, DicomCMoveResponse response)
        {
            if (response.Remaining == 0)
                Console.WriteLine(response.ToString());
        }
        static void Main(string[] args)
        {
            try
            {
                LoggingConfiguration config = new LoggingConfiguration();
                ColoredConsoleTarget ct = new ColoredConsoleTarget();
                ct.Layout = "${message}";
                config.AddTarget("Console", ct);
                config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, ct));
                LogManager.Configuration = config;

                var dict = DicomDictionary.Default;
                var server = new DicomServer<CStoreSCP>(104);

                DicomClient client = new DicomClient();
               
                // echo
                DicomCEchoRequest cEcho = new DicomCEchoRequest();
                client.AddRequest(cEcho);

                // find
                DicomCFindRequest cFind = DicomCFindRequest.CreateStudyQuery(patientId: "geservice");
                client.AddRequest(cFind);

                // move
                DicomCMoveRequest cMove = new DicomCMoveRequest("STORESCP", "1.2.840.113619.6.295.318370558294670917247756468170410924047", "1.2.840.113619.2.295.4120.6367188.27525.1349361076.223");
                cMove.OnResponseReceived = MoveDelegate;
                client.AddRequest(cMove);

                client.Send("192.168.1.214", 11112, false, "my AE", "their AE");

                Console.ReadLine();

            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString() + "/n" + e.GetType() + "/n" + e.Message);
            }
            Console.ReadLine();
        }
    }
}

bulkmai...@gmail.com

unread,
Apr 15, 2013, 11:08:27 AM4/15/13
to fo-d...@googlegroups.com
More exact information on the first failure stack trace.  Visual studio provides the following information:
This thread is stopped with only external code frames on the call stack.  External code frames are typically from framework code but can also include other optimized modules which are loaded in the target process.
 
Call stack with external code
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
[Native to Managed Transition]

bulkmai...@gmail.com

unread,
Apr 15, 2013, 3:33:28 PM4/15/13
to fo-d...@googlegroups.com
I have resolved the second issue.  It was due to the server thread not always having time to spin up before the inbound c-store requests.
 
The second issue still occurs about 1 out of 5 times.  I'm not sure how to go about looking into the problem.

bulkmai...@gmail.com

unread,
Apr 19, 2013, 11:33:44 PM4/19/13
to fo-d...@googlegroups.com
Nobody ...
 

Vinay Rathore

unread,
Jan 23, 2015, 11:05:15 AM1/23/15
to fo-d...@googlegroups.com
Hi ,
    Please help me , I am getting Pending Status in C-Move Method and Data set NuLL.


public void GetPatient(string remotehost, Int16 port, string callingAET, string calledAET, string PatientID, string InstanaceUID, string SeriesInsUid)
        {
            //MessageBox.Show(remotehost + " " + port.ToString() + " " + callingAET + " " + calledAET + " " + PatientID + " " + InstanaceUID + " " +  SeriesInsUid);
           
            DicomCFindRequest fr = DicomCFindRequest.CreatePatientQuery(PatientID);
            MessageBox.Show(callingAET + " " + InstanaceUID);
            DicomCMoveRequest mr = new DicomCMoveRequest(callingAET, InstanaceUID); //, SeriesInsUid);
            mr.OnResponseReceived = MoveFinished;

            var client = new DicomClient();
            client.NegotiateAsyncOps(2, 0);
            client.AddRequest(fr);
            client.AddRequest(mr);
            //client.BeginSend(remotehost, port, false, callingAET, calledAET, Done, client);
            client.Send(remotehost, port, false, callingAET, calledAET);
        }

        public void MoveFinished(DicomCMoveRequest request, DicomCMoveResponse response)
        {
           
            MessageBox.Show("MoveFinished " + response.Status.Description);
            //.... No code yet but inside response only a command dataset with 9 items, unsigned ints.. no images anywhere
        }

        public void Done(IAsyncResult result)
        {
            //MessageBox.Show("Done " + result.ToString());
            //...Blank, just made this to get BeginSend to work? Something goes here???
        }
    
 
Reply all
Reply to author
Forward
0 new messages