sendEchoRequest anwers with an abort

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Horst Balthasar
Posts: 18
Joined: Mon, 2021-02-01, 11:32

sendEchoRequest anwers with an abort

#1 Post by Horst Balthasar » Thu, 2022-11-24, 10:33

To check the connection to the worklist server with the sendEchoRequest function, I got an error with a P abort as a response.
The log messages:
2022-11-23 12:10:34.941 DEBUG: $dcmtk: verifyConnection v3.6.5 2019-10-28 $
2022-11-23 12:10:34.941 DEBUG:
2022-11-23 12:10:34.942 TRACE: Configured 0 presentation contexts from config file
2022-11-23 12:10:34.942 TRACE: Adding another 1 presentation contexts configured for SCU
2022-11-23 12:10:34.943 DEBUG: Configured a total of 1 presentation contexts for SCU
2022-11-23 12:10:34.943 INFO: Request Parameters:
2022-11-23 12:10:34.943 INFO: ====================== BEGIN A-ASSOCIATE-RQ =====================
2022-11-23 12:10:34.943 INFO: Our Implementation Class UID: 1.2.276.0.7230010.3.0.3.6.5
2022-11-23 12:10:34.943 INFO: Our Implementation Version Name: OFFIS_DCMTK_365
2022-11-23 12:10:34.943 INFO: Their Implementation Class UID:
2022-11-23 12:10:34.943 INFO: Their Implementation Version Name:
2022-11-23 12:10:34.943 INFO: Application Context Name: 1.2.840.10008.3.1.1.1
2022-11-23 12:10:34.943 INFO: Calling Application Name: IMEDKOLPOS3181
2022-11-23 12:10:34.943 INFO: Called Application Name: DCMMWL
2022-11-23 12:10:34.943 INFO: Responding Application Name: DCMMWL
2022-11-23 12:10:34.943 INFO: Our Max PDU Receive Size: 16384
2022-11-23 12:10:34.943 INFO: Their Max PDU Receive Size: 0
2022-11-23 12:10:34.943 INFO: Presentation Contexts:
2022-11-23 12:10:34.943 INFO: Context ID: 1 (Proposed)
2022-11-23 12:10:34.943 INFO: Abstract Syntax: =VerificationSOPClass
2022-11-23 12:10:34.943 INFO: Proposed SCP/SCU Role: Default
2022-11-23 12:10:34.943 INFO: Proposed Transfer Syntax(es):
2022-11-23 12:10:34.943 INFO: =LittleEndianExplicit
2022-11-23 12:10:34.943 INFO: =BigEndianExplicit
2022-11-23 12:10:34.943 INFO: =LittleEndianImplicit
2022-11-23 12:10:34.943 INFO: Requested Extended Negotiation: none
2022-11-23 12:10:34.943 INFO: Accepted Extended Negotiation: none
2022-11-23 12:10:34.943 INFO: Requested User Identity Negotiation: none
2022-11-23 12:10:34.943 INFO: User Identity Negotiation Response: none
2022-11-23 12:10:34.943 INFO: ======================= END A-ASSOCIATE-RQ ======================
2022-11-23 12:10:34.943 INFO: Requesting Association
2022-11-23 12:10:34.943 TRACE: DUL FSM Table: State: 1 Event: 0
2022-11-23 12:10:34.943 TRACE: DUL Event: A-ASSOCIATE request (local user)
2022-11-23 12:10:34.943 TRACE: DUL Action: AE 1 Transport Connect
2022-11-23 12:10:34.943 TRACE: DUL FSM Table: State: 4 Event: 16
2022-11-23 12:10:34.943 TRACE: DUL Event: Transport connection closed
2022-11-23 12:10:34.943 TRACE: DUL Action: AA 4 Indicate AP Abort
2022-11-23 12:10:34.943 DEBUG: Association Request Failed: 0006:031b Failed to establish association
2022-11-23 12:10:34.943 DEBUG: 0006:0317 Peer aborted Association (or never connected)
2022-11-23 12:10:34.943 DEBUG: 0006:031c TCP Initialization Error: Connection refused
2022-11-23 12:10:34.943 ERROR: Unable to negotiate association: Failed to establish association
2022-11-23 12:10:34.943 ERROR: 0006:0317 Peer aborted Association (or never connected)
2022-11-23 12:10:34.943 ERROR: 0006:031c TCP Initialization Error: Connection refused

Can you have a idea, what is the reason of this error ?

Michael Onken
DCMTK Developer
Posts: 1924
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: sendEchoRequest anwers with an abort

#2 Post by Michael Onken » Thu, 2022-11-24, 10:55

Hi,

it looks like there was no connection at all, i.e. the server is not reachable (behind firewall, wrong IP/port, etc.). At least I think that such a problem would result in the same log.

Otherwise I have no idea what might be the problem.

Best regards,
Michael

Horst Balthasar
Posts: 18
Joined: Mon, 2021-02-01, 11:32

Re: sendEchoRequest anwers with an abort

#3 Post by Horst Balthasar » Fri, 2022-11-25, 11:04

Using echoscu with same input parameters y don't have any problems.

Best regards,

Horst

Horst Balthasar
Posts: 18
Joined: Mon, 2021-02-01, 11:32

Re: sendEchoRequest anwers with an abort

#4 Post by Horst Balthasar » Fri, 2022-11-25, 12:26

Hi,

To check the network connection I use the following code:

int DcmClient::echo()
{
OFString temp_str("");

/* print resource identifier */
static char echo_funcid[] = "$dcmtk: verifyConnection v" OFFIS_DCMTK_VERSION " " OFFIS_DCMTK_RELEASEDATE " $";
OFLOG_DEBUG(dcmClientLogger, echo_funcid << OFendl);

/// Add the requested presentation context, we prefer to use LittleEndianExplicit transfer syntax
OFList<OFString> xfers;
prepareTransferSyntaxes(EXS_LittleEndianExplicit, xfers);

OFCondition cond = addPresentationContext(UID_VerificationSOPClass, xfers);
if (cond.bad() )
{
OFLOG_FATAL(dcmClientLogger, DimseCondition::dump(temp_str, cond));
return EXITCODE_NO_PRESENTATION_CONTEXT;
}

/// initialize network
cond = initNetwork();
if (cond.bad() )
{
OFLOG_ERROR(dcmClientLogger, "Unable to set up the network: " << cond.text());
return EXITCODE_CANNOT_INITIALIZE_NETWORK;
}

/// Negotiate Association
cond = negotiateAssociation();
if (cond.bad() )
{
OFLOG_ERROR(dcmClientLogger, "Unable to negotiate association: " << cond.text());
return EXITCODE_CANNOT_NEGOTIATE_ASSOCIATION;
}

/// assemble and send C-ECHO request
cond = sendECHORequest(0);

/// Check the status of the verification request
if (cond.bad() )
{
OFLOG_ERROR(dcmClientLogger, "Could not process C-ECHO with the server: " << cond.text());
OFLOG_ERROR(dcmClientLogger, "Echo SCU Failed: " << DimseCondition::dump(temp_str, cond));
OFLOG_INFO(dcmClientLogger, "Aborting Association");

/* close current network association */
finishAssociation(cond);
return EXITCODE_CANNOT_SEND_REQUEST;
}

/// close current network association
if (cond == EC_Normal )
{
/* release association */
OFLOG_INFO(dcmClientLogger, "Releasing Association");
releaseAssociation();
}
else
{
// peer finish the association
finishAssociation(cond);
}

LogInfo("DcmClient::echo", "Connection to %s established!", getPeerAETitle().c_str());

return EXITCODE_NO_ERROR; /// \return status, EXITCODE_NO_ERROR if successful, an error code otherwise
}


With this function I get the said error, but with echoscu and the same AE Title and Port is all ok.

Best regards,

Horst

Michael Onken
DCMTK Developer
Posts: 1924
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: sendEchoRequest anwers with an abort

#5 Post by Michael Onken » Fri, 2022-11-25, 12:34

Hi Horst,

thank you for the details (I assume that DcmClient is derived from DcmSCU). I will have a look.

Best regards,
Michael

Michael Onken
DCMTK Developer
Posts: 1924
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: sendEchoRequest anwers with an abort

#6 Post by Michael Onken » Fri, 2022-11-25, 12:38

Do you call

Code: Select all

setPeerHostName(<host>)
and

Code: Select all

setPeerPort(<port>)
somewhere?

Horst Balthasar
Posts: 18
Joined: Mon, 2021-02-01, 11:32

Re: sendEchoRequest anwers with an abort

#7 Post by Horst Balthasar » Fri, 2022-11-25, 15:01

Hi,

Thanks for answer.

Yes the DcmClient is derived from DcmScu.

Yes I call the set* functions as the following:

/// set network parameters
setAETitle(aeTitle);
setPeerHostName(host);
setPeerPort(port);
setPeerAETitle(peerAETitle);

setDIMSETimeout(dimseTimeoutInSec);
setACSETimeout(acseTimeoutInSec);

The network parameters are read in from a JSON configuration file.

Best regards,

Horst

Michael Onken
DCMTK Developer
Posts: 1924
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: sendEchoRequest anwers with an abort

#8 Post by Michael Onken » Fri, 2022-12-02, 10:31

Hi Horst,

sorry if this is obvious for you, but did you also check that hostname and port have meaningful values in the code, i.e. did you print them to check their values or insert "hard" values to make sure this is not the problem?

It would be great if you could provide a minimal complete example code snippet that demonstrates the issue. It is hard to debug from outside.

Best regards,
Michael

Horst Balthasar
Posts: 18
Joined: Mon, 2021-02-01, 11:32

Re: sendEchoRequest anwers with an abort

#9 Post by Horst Balthasar » Sun, 2022-12-04, 17:04

Hi,

I think I found the error with the abort. In response to your request for call the setHostName and setPeerPort functions, I checked the source code again and found that I call the setHostName function, but only at initialization.

But since in our use case the worklist server and the storage server have different IP addresses, it happens that I check the connection with the correct port but not with the correct IP address.

We have created the situation in the company with the different worklist and storage servers and could reproduce the problem.

Thanks again for your advice!

To solve the problem I have the following questions:

1./ Does it make sense to create 2 instances of my DCmClient (one each for the wordlist and one for storage) or just one, but always reassign the network settings?

2./ Is the class DcmSCU thread-safe? Question, because we call the echo function (check if the network is available or not?) in a thread. If the network is not available, the images are not displayed continuously because of the timeout (image "freezes") Is there any alternative for this ?

Best regards,

Horst

Michael Onken
DCMTK Developer
Posts: 1924
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: sendEchoRequest anwers with an abort

#10 Post by Michael Onken » Tue, 2022-12-06, 12:29

Hi Horst,

good that it works now :-)
1./ Does it make sense to create 2 instances of my DCmClient (one each for the wordlist and one for storage) or just one, but always reassign the network settings?
It is up to you, both should work. Personally I would create two different classes for that (DcmWorklistClient, DcmStorageClient) since over time they probably will differ more and more.
2./ Is the class DcmSCU thread-safe? Question, because we call the echo function (check if the network is available or not?) in a thread. If the network is not available, the images are not displayed continuously because of the timeout (image "freezes") Is there any alternative for this ?
It is not thread-safe, sorry, and it's not planned (a patch is welcome, of course, though).

Best regards,
Michael

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest