How to specify a timeout for receiving data via storescu utility

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
Matterhorn
Posts: 8
Joined: Wed, 2012-02-01, 09:29

How to specify a timeout for receiving data via storescu utility

#1 Post by Matterhorn »

Hi, all
I am using storescu utility brought with dcmtk 3.6 to do some test.
1. Start a "storage SCP emulator" utility from DVT tool on Windows 7;
2. Start storescu on Linux to export an image to Windows, and unplugged the network cable while data tranferring:

~/dcmtk/bin $date&&./storescu -v -to 30 3.35.63.54 1026 /media/sf_share/d7/sample_files/IM1 ||date
Thu Feb 2 09:30:43 CST 2012
I: checking input files ...
I: Requesting Association
I: Association Accepted (Max Send PDV: 16372)
I: Sending file: /media/sf_share/d7/sample_files/IM1
I: Transfer Syntax: LittleEndianExplicit -> LittleEndianExplicit
I: Sending Store Request: MsgID 1, (RF)
XMIT: ..................................................................................E: Store Failed, file: /media/sf_share/d7/sample_files/IM1:
E: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Operation now in progress) occurred in routine: writeDataPDU
E: Store SCU Failed: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Operation now in progress) occurred in routine: writeDataPDU
I: Aborting Association
E: Association Abort Failed: 0006:031d TCP I/O Error (No route to host) occurred in routine: sendAbortTCP
Thu Feb 2 09:46:12 CST 2012

So, if I only specify -to option, it will wait about 16 minutes to report the broken network.

3. this time, I specify -to, -ta, -td option:
~/dcmtk/bin $date&&./storescu -v -to 30 -ta 50 -td 50 3.35.63.54 1026 /media/sf_share/d7/sample_files/IM1 ||date
Thu Feb 2 09:53:50 CST 2012
I: checking input files ...
I: Requesting Association
I: Association Accepted (Max Send PDV: 16372)
I: Sending file: /media/sf_share/d7/sample_files/IM1
I: Transfer Syntax: LittleEndianExplicit -> LittleEndianExplicit
I: Sending Store Request: MsgID 1, (RF)
XMIT: ........................................................................................................E: Store Failed, file: /media/sf_share/d7/sample_files/IM1:
E: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Operation now in progress) occurred in routine: writeDataPDU
E: Store SCU Failed: 0006:020e DIMSE Failed to send message
E: 0006:031d TCP I/O Error (Operation now in progress) occurred in routine: writeDataPDU
I: Aborting Association
E: Association Abort Failed: 0006:031d TCP I/O Error (No route to host) occurred in routine: sendAbortTCP
Thu Feb 2 10:09:25 CST 201

Again, it also wait about 16 minutes.

My Linux:
~/dcmtk/bin $uname -a
Linux localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux

Any suggestion how can I specify a timeout when the network suddenly becomes unavailable such as cable is unplugged while data transferring?

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

#2 Post by Michael Onken »

Hi,

if you pull out the network cable or disconnect from the network in any other way you will have a complete network failure and there will be no way with DCMTK to continue where you have been stopped (e.g. in the middle of sending a DICOM dataset) -- you just have to send again. I guess (however, I might be wrong...) that this is not possible with any DICOM application.

Best regards,
Michael

Matterhorn
Posts: 8
Joined: Wed, 2012-02-01, 09:29

#3 Post by Matterhorn »

Michael Onken wrote:Hi,

if you pull out the network cable or disconnect from the network in any other way you will have a complete network failure and there will be no way with DCMTK to continue where you have been stopped (e.g. in the middle of sending a DICOM dataset) -- you just have to send again. I guess (however, I might be wrong...) that this is not possible with any DICOM application.

Best regards,
Michael
Thanks.
Yes, I agree that I should re-send my data in that case. But, I do not want to wait so long - 16 minutes to get aware of something wrong, do you have any idea that I can specify a timeout for that?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#4 Post by J. Riesmeier »

Do you know where the time is spent? For example, you could enable the timestamp output of the logger, so you can see the exact time when a log message is reported.

I remember that we added a fixed timeout of 60 seconds for the receiving part (SCP) in order to make sure that the association is terminated if the receiver looses the connection to the sender. This patch is already part of DCMTK 3.6.0.

Maybe, it is also worth to test the current snapshot in order to see whether the behavior you've observed has changed since last release ...

Matterhorn
Posts: 8
Joined: Wed, 2012-02-01, 09:29

#5 Post by Matterhorn »

J. Riesmeier wrote:Do you know where the time is spent? For example, you could enable the timestamp output of the logger, so you can see the exact time when a log message is reported.

I remember that we added a fixed timeout of 60 seconds for the receiving part (SCP) in order to make sure that the association is terminated if the receiver looses the connection to the sender. This patch is already part of DCMTK 3.6.0.

Maybe, it is also worth to test the current snapshot in order to see whether the behavior you've observed has changed since last release ...
Yes, after digging into source codes, I locate the function ::write(...) called in DcmTCPConnection::write() function, which may wait about 16 minutes if the network cable unplugged while data transferring.

I saw the code you mentioned about fixed timeout of 60 seconds, but that seems to be useless, as if I specify -ta and -td option in command line, storescu utility still waits 16 minutes to report error if I unplug the cable.

So, my question is, first why -ta and -td options have no effect and second, how can I specify a timeout for a SCU application when the cable is unplugged if I do want to wait 16 minutes to know something is wrong?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#6 Post by J. Riesmeier »

So, my question is, first why -ta and -td options have no effect
The support of timeouts in the network module is still somewhat incomplete. It has been added after the initial design/implementation, so the timeout parameters are not always considered appropriately (see history of changes in the last couple of years).
and second, how can I specify a timeout for a SCU application when the cable is unplugged if I do want to wait 16 minutes to know something is wrong?
This is something we would have to investigate ... I'll add this issue to our to-do list.

Matterhorn
Posts: 8
Joined: Wed, 2012-02-01, 09:29

#7 Post by Matterhorn »

J. Riesmeier wrote:
So, my question is, first why -ta and -td options have no effect
The support of timeouts in the network module is still somewhat incomplete. It has been added after the initial design/implementation, so the timeout parameters are not always considered appropriately (see history of changes in the last couple of years).
and second, how can I specify a timeout for a SCU application when the cable is unplugged if I do want to wait 16 minutes to know something is wrong?
This is something we would have to investigate ... I'll add this issue to our to-do list.
Many thanks for your reply! Now I know some reasons to some level.

Still I consider the document from dcmtk is far away from being perfect...

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#8 Post by J. Riesmeier »

Still I consider the document from dcmtk is far away from being perfect...
What do you mean by "document from dcmtk"?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#9 Post by J. Riesmeier »

I just checked what a recent Linux system (Ubuntu 11.10) does when the network cable is unplugged during the storage transfer: storescp detects this problem after the specified time-out of 60 seconds, and storescu hangs for a very long time. So, we have a system where we can reproduce the behavior you've described :-) And, maybe we can use the same approach for sending as for receiving data ...

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#10 Post by J. Riesmeier »

I guess this issue has been solved with the following commit. Thanks again for reporting this issue to us.

As mentioned before, we are aware of the fact that the support of timeout value in the network module is not yet perfect, but better than nothing. A cleanup of the code is still on our list of things to do ...

nicolas_dicom
Posts: 19
Joined: Fri, 2010-10-29, 21:48

#11 Post by nicolas_dicom »

Sorry, I decided to move this message to a new topic called
storescu TCP/IP error messages - dcmtk error type

Regards,

Nicolás
Last edited by nicolas_dicom on Mon, 2012-02-13, 00:28, edited 1 time in total.

nicolas_dicom
Posts: 19
Joined: Fri, 2010-10-29, 21:48

#12 Post by nicolas_dicom »

Hi all,

I have the same issue mentioned by Matterhorn

I'm using Ubuntu 11.04 DCMTK 3.6.0

2.6.38-13-generic #54-Ubuntu SMP Tue Jan 3 13:38:12 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


Have the same issue in Windows 7 professional 64bits with both DCMTK version
3.5.4 and 3.6.0



if you unplug the wire at the time Requesting Association , the -to 5 second takes effect

Code: Select all

}

D:     Abstract Syntax: =XRayRadiofluoroscopicImageStorage
D:     Proposed SCP/SCU Role: Default
D:     Proposed Transfer Syntax(es):
D:       =LittleEndianExplicit
D:       =BigEndianExplicit
D:       =LittleEndianImplicit
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation:  none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response:  none
D: ======================= END A-ASSOCIATE-RQ ======================
I: Requesting Association
F: Association Request Failed: 0006:031b Failed to establish association
F: 0006:0317 Peer aborted Association (or never connected)
F: 0006:031c TCP Initialization Error: Operation now in progress (Timeout)


But once you are here : Constructing Associate RQ PDU
you will have to wait for more than 2 minutes

Code: Select all


D:   Context ID:        253 (Proposed)
D:     Abstract Syntax: =XRayRadiofluoroscopicImageStorage
D:     Proposed SCP/SCU Role: Default
D:     Proposed Transfer Syntax(es):
D:       =JPEGLossless:Non-hierarchical-1stOrderPrediction
D:   Context ID:        255 (Proposed)
D:     Abstract Syntax: =XRayRadiofluoroscopicImageStorage
D:     Proposed SCP/SCU Role: Default
D:     Proposed Transfer Syntax(es):
D:       =LittleEndianExplicit
D:       =BigEndianExplicit
D:       =LittleEndianImplicit
D: Requested Extended Negotiation: none
D: Accepted Extended Negotiation:  none
D: Requested User Identity Negotiation: none
D: User Identity Negotiation Response:  none
D: ======================= END A-ASSOCIATE-RQ ======================
I: Requesting Association
D: Constructing Associate RQ PDU


That was what I could see so far,

Regards,

Nicolás

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#13 Post by J. Riesmeier »

To "nicolas_dicom": Could you please test whether the above mentioned patch also solves your problem?

nicolas_dicom
Posts: 19
Joined: Fri, 2010-10-29, 21:48

#14 Post by nicolas_dicom »

Hello ,

I modified the file dcmtrans.cc
from
http://git.dcmtk.org/web?p=dcmtk.git;a= ... 011b954187

After that, I compiled the code -> successfully
dcmtk-3.6.0/dcmnet/libsrc# make clean all and make all
dcmtk-3.6.0/dcmnet# make clean all and male all
I also compiled dcmtk-3.6.0/dcmnet/apps "storescu"

Just to see if the change takes effect I added the line:
DCMNET_INFO("Hi there");

Code: Select all

nicolas@orus:/dcmtk-3.6.0/dcmnet/apps$ ./storescu -v -xs -to 3 -aet SENDER -aec IADCMSERVER 192.168.5.111 110 1.dcm 
I: checking input files ...
I: Requesting Association


I: Hi there


I: Association Accepted (Max Send PDV: 16372)
I: Sending file: 1.dcm
I: Transfer Syntax: LittleEndianImplicit -> LittleEndianExplicit
I: Sending Store Request: MsgID 1, (CR)
I: Received Store Response
I: Releasing Association

Did I forget something ? didn't work. Storescu keeps waiting for long time. I guess I did something wrong.
As you can see, the version is dcmtk-3.6.0

Should I also change next files ?
dcmnet/libsrc/dul.cc
dcmnet/libsrc/Makefile.dep


I still can see
setting network send timeout to 60 seconds

Code: Select all


D: ======================= END A-ASSOCIATE-RQ ======================
I: Requesting Association
D: setting network send timeout to 60 seconds
I: Hi there
D: setting network receive timeout to 60 seconds
D: Constructing Associate RQ PDU


I also tried to modify the dul.cc file from
http://git.dcmtk.org/web?p=dcmtk.git;a= ... 2cfa72074d

Code: Select all


99506L -Wall  dul.cc
dul.cc: In function ‘OFCondition DUL_RejectAssociationRQ(DUL_ASSOCIATIONKEY**, DUL_ABORTITEMS*, int)’:
dul.cc:793:20: error: ‘DULC_ILLEGALREJECTSOURCE’ was not declared in this scope
make: *** [dul.o] Error 1
Please, let me know if I need to change another file. Will try again

Regards,
Nicolás

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#15 Post by J. Riesmeier »

Did I forget something ? didn't work. Storescu keeps waiting for long time. I guess I did something wrong.
Maybe, you should first try to use the current development version from the git repository (i.e. the whole version) and see whether it solves your problem.

Post Reply

Who is online

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