Hi Michael,
Thanks for the suggestion.
Here is the output when I run with the atExitDebug variable set on windows-x64-static. It exits normally.
J:\epics\devel\example\iocBoot\iocexample>..\..\bin\windows-x64-static\example.exe st.cmd
#!../../bin/windows-x64/example
#< envPaths
## Register all support components
dbLoadDatabase "../../dbd/example.dbd"
example_registerRecordDeviceDriver(pdbbase)
## Load record instances
#dbLoadRecords("../../db/example.db","user=epics")
var atExitDebug 1
startPVAServer
iocInit()
Starting iocInit
############################################################################
## EPICS R7.0.8
## Rev.
## Rev. Date :
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncexample,"user=epics"
epics>
epics> exit
atExit exitDatabase(0000000000000000)
atExit errlogExitHandler(000002B83242E040)
atExit twdShutdown(0000000000000000)
atExit syncShutdown(0000000000000000)
atExit decShutdown(0000000000000000)
atExit dbndShutdown(0000000000000000)
atExit arrShutdown(0000000000000000)
J:\epics\devel\example\iocBoot\iocexample>
Here is the output when I run with the atExistDebug variable set on windows-x64. It prints the same atExit messages but then hangs. Does this mean it is handing in
arrShutdown, or later on?
J:\epics\devel\example\iocBoot\iocexample>..\..\bin\windows-x64\example.exe st.cmd
#!../../bin/windows-x64/example
#< envPaths
## Register all support components
dbLoadDatabase "../../dbd/example.dbd"
example_registerRecordDeviceDriver(pdbbase)
## Load record instances
#dbLoadRecords("../../db/example.db","user=epics")
var atExitDebug 1
startPVAServer
iocInit()
Starting iocInit
############################################################################
## EPICS R7.0.8
## Rev.
## Rev. Date :
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncexample,"user=epics"
epics> exit
atExit exitDatabase(0000000000000000)
atExit errlogExitHandler(0000020FE7181060)
atExit twdShutdown(0000000000000000)
atExit syncShutdown(0000000000000000)
atExit decShutdown(0000000000000000)
atExit dbndShutdown(0000000000000000)
atExit arrShutdown(0000000000000000)
I had to kill the process with the Windows Task Manager at this point.
I just found something interesting. If I comment out the startPVAServer line it does not hang (which I already knew), but there is now a new atExit handler called first,
@pva_server_cleanup.
J:\epics\devel\example\iocBoot\iocexample>..\..\bin\windows-x64\example.exe st.cmd
#!../../bin/windows-x64/example
#< envPaths
## Register all support components
dbLoadDatabase "../../dbd/example.dbd"
example_registerRecordDeviceDriver(pdbbase)
## Load record instances
#dbLoadRecords("../../db/example.db","user=epics")
var atExitDebug 1
#startPVAServer
iocInit()
Starting iocInit
############################################################################
## EPICS R7.0.8
## Rev.
## Rev. Date :
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncexample,"user=epics"
epics> exit
atExit &pva_server_cleanup(0000000000000000)
atExit exitDatabase(0000000000000000)
atExit twdShutdown(0000000000000000)
atExit errlogExitHandler(0000019F55DD8340)
atExit syncShutdown(0000000000000000)
atExit decShutdown(0000000000000000)
atExit dbndShutdown(0000000000000000)
atExit arrShutdown(0000000000000000)
J:\epics\devel\example\iocBoot\iocexample>
If I type the iocsh command stopPVAServer before typing exit then it works fine.
J:\epics\devel\example\iocBoot\iocexample>..\..\bin\windows-x64\example.exe st.cmd
#!../../bin/windows-x64/example
#< envPaths
## Register all support components
dbLoadDatabase "../../dbd/example.dbd"
example_registerRecordDeviceDriver(pdbbase)
## Load record instances
#dbLoadRecords("../../db/example.db","user=epics")
var atExitDebug 1
startPVAServer
iocInit()
Starting iocInit
############################################################################
## EPICS R7.0.8
## Rev.
## Rev. Date :
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncexample,"user=epics"
epics> stopPVAServer
epics> exit
atExit exitDatabase(0000000000000000)
atExit errlogExitHandler(00000259BB9AEA70)
atExit twdShutdown(0000000000000000)
atExit syncShutdown(0000000000000000)
atExit decShutdown(0000000000000000)
atExit dbndShutdown(0000000000000000)
atExit arrShutdown(0000000000000000)
J:\epics\devel\example\iocBoot\iocexample>
It looks to me like the PVA server is not stopping as part of the IOC shutdown on windows-x64 unless it is done manually at the command line first.
Thanks,
Mark
-----Original Message-----
From: Michael Davidsaver <mdavidsaver at gmail.com>
Sent: Wednesday, March 13, 2024 6:10 AM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: core-talk at aps.anl.gov
Subject: Re: startPVAServer prevents windows-x64 IOC from exiting
Hi Mark,
My first suspicion is that an epicsAtExit() handler is hanging, although I can't explain why this would differ between static to dynamic linking.
Setting the atExitDebug IOC shell variable will print each handler name as it is executed.
> epics> var atExitDebug 1
> epics> exit
> atExit exitDatabase((nil))
> atExit twdShutdown((nil))
> atExit errlogExitHandler(0x558c4d454fb0) atExit rlExit((nil)) atExit
> syncShutdown((nil)) atExit decShutdown((nil)) atExit
> dbndShutdown((nil)) atExit arrShutdown((nil)) atExit
> ClockTime_Shutdown((nil))
On 3/12/24 15:08, Mark Rivers via Core-talk wrote:
> I previously sent this message to both tech-talk and core-talk. Neither Andrew Johnson nor I received it. I know that some people who are subscribed to tech-talk did receive it. It looks like perhaps people who are subscribed to
both lists do not receive the message at all?
>
> I the future I will only send to one list or the other, since Andrew points out that core-talk is a subset of tech-talk.
>
> *From:*Mark Rivers
> *Sent:* Tuesday, March 12, 2024 3:54 PM
> *To:* tech-talk at aps.anl.gov;
core-talk at aps.anl.gov
> *Subject:* startPVAServer prevents windows-x64 IOC from exiting
>
> Folks,
>
> I have found a serious problem with using the PVA server on Windows IOCs that are dynamically built. The IOC runs fine, but cannot be exited either with the “exit” command or with ^C. It can only be killed with the Windows Task Manager.
The problem occurs on the following:
>
> * EPICS_HOST_ARCH: window-x64, windows-x64-debug. Does not occur on windows-x64-static.
> * EPICS BASE: 7.0.7 and 7.0.8. Did not test other versions.
> * Test application: makeBaseApp.pl from base 7.0.8. Modified st.cmd to add the line startPVAServer just before iocInit. Also happens in ADSimDetector with commonPlugins.cmd.
>
> Thanks,
>
> Mark
>