storescp: execution of command fails

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
OliWe
Posts: 5
Joined: Tue, 2019-12-10, 08:44

storescp: execution of command fails

#1 Post by OliWe »

Dear all,

we are using storescp without any problems since years on Windows platforms.
The -xcs option is used to call a batch file after the DICOMs are stored on a HD.

Now, after an upgrade of one PC from Win 7 to Win 10 we are running in problems.
The call of the batch file works for some time - then we get a cmd.exe error (0xc0000142) and the batch file will not be called for all later received DICOM studies.

After a reboot everything will work for some short time (sometimes 30min, sometimes 2h) and then we get the cmd.exe error again.

Does anyone have any idea what the cause might be?

I used Process Manager / Task Manager / Process Monitor but did not find anything helpful.

The cmd.exe call failed with precompiled storescp contained in dcmtk 3.6.5 and 3.6.0.

storescp.exe is called by this line:

"C:\Program Files\yacta64\storescp.exe" -tos 30 -aet YACTA +x= +t= -xcs "yacta_worklist64.bat #p" -sp -od "R:\ungesicherte_Daten\yacta" 4444

using a CreateProcess call.

This command worked perfectly on Win 7 but crashes on Win 10.
I can reproduce the cmd.exe error on different Win 10 machines.

Best wishes,
OliWe
Last edited by OliWe on Thu, 2019-12-12, 20:27, edited 1 time in total.

OliWe
Posts: 5
Joined: Tue, 2019-12-10, 08:44

Re: storescp: execution of command fails

#2 Post by OliWe »

I compared the storescp log (with -v -d option) for the same CT data once when the command triggered by -xcs is executed once when it was not executed.
No difference.

Once the -xcs option stops working, storescp is still receiving images - just the -xcs command will not be executed because the cmd.exe is somehow broken.

Correction: A system reboot is not necessary for the -xcs option of the storescp to work again.
All you have to do is restart the storescp.

The directory where the storescp is storing the CTs is monitored by a directory-wathching-thread.
This was never a problem - I checked this again - could not find any problem.

Does anyone have any idea what to check additionally?

Should I rebuild the storescp by my own - will there be a difference?
I do not think so because I have the same problem with precompiled storescp 3.6.0 (statically linked) and 3.6.5 (dynamic).

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

Re: storescp: execution of command fails

#3 Post by Michael Onken »

Hi OliWe,

unfortunately I have not really an idea.

Are you maybe accessing a network share in your -xcs executed command that may "hang" every now and then?

Best regards,
Michael

OliWe
Posts: 5
Joined: Tue, 2019-12-10, 08:44

Re: storescp: execution of command fails

#4 Post by OliWe »

Hi Michael,

thanks for your reply.

On one of the tested PCs a network share is used, and I had the same idea than you some days ago.
But not on the other two PCs where I was able to reproduce the problem.
The share is stable.

All PCs are on Win 10.

I replaced -xcs "yacta_worklist64.bat #p" by -xcs "powershell.exe yacta_worklist64.bat #p" - same problem - powershell.exe stops working after a while.

We played around with security options two days ago - no effect.
But to be honest, there are many different ways in Win 10 in security settings.
I'm not sure exactly what to change.
Today I defined exceptions in Windows Defender - storescp.exe, cmd.exe, powershell.exe, yacta64.exe (my software), and the Program Folder.
Systems runs for over 2 hours without error - 21 CT volumes have been evaluated
... and now the error is back :-(

I compared the output of the Process Monitor and the storescp log files.
Until the crashing cmd.exe the logs are identical.

After the cmd crash I can copy the crashing cmd call and push it in another cmd (not called from the storescp) - works without problems.
Just the running storescp is not able to execute another command triggered by -xcs.
But the storescp is still reveiving and storing the DICOMs.
After a restart of the storescp everything works fine again for some time.

I have no idea what is going on.

Best regards,
Oliver

OliWe
Posts: 5
Joined: Tue, 2019-12-10, 08:44

Re: storescp: execution of command fails

#5 Post by OliWe »

I have identified and fixed the problem.
Here, just for the record, the story in short:

I am developing a processmanager.exe, a tool for organizing image processing tasks on a windows workstation.
This tool starts a storescp.exe on start up in order to receive images.
storescp.exe is created by calling the CreateProcess function.
processmanager.exe manages different threads.
One thread is a "killer"-thread - it kills managed images processing tasks if a maximal allowed runtime is reached.
This killer-"thread" may not kill the processmanager.exe and the storescp.exe.
If storescp.exe is spawned via CreateProcess an additional process conhost.exe is spawned.
This conhost.exe was killed by the "killer"-thread after the maximal allowed runtime was reached :-)
storescp.exe is not able to run a command (at least not cmd.exe and powershell.exe or a batch file) triggered by -xcs option if the corresponding conhost.exe is not running anymore.
But storescp.exe can still receive images without the conhost.exe.

This was not a problem on Win 7 systems but it is a problem on Win 10.
Shame on me.
Last edited by OliWe on Mon, 2019-12-16, 08:42, edited 1 time in total.

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

Re: storescp: execution of command fails

#6 Post by Michael Onken »

Alright, thanks for sharing the solution :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Majestic-12 [Bot] and 1 guest