[ 
https://issues.apache.org/jira/browse/DAEMON-449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Thomas resolved DAEMON-449.
--------------------------------
    Resolution: Invalid

Given the lack of update for an extended period of time, I am assuming the 
issue was indeed that the batch file was exiting before the service was fully 
started.

If this is not the case, feel free to re-open but you'll need to provide a 
minimal test case that demonstrates the issue.

> Prunsrv fails to stop Open Liberty Windows service
> --------------------------------------------------
>
>                 Key: DAEMON-449
>                 URL: https://issues.apache.org/jira/browse/DAEMON-449
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: prunsrv
>    Affects Versions: 1.2.2
>         Environment: I don't think the Windows version matters, but I am 
> using:
> Microsoft Windows [Version 10.0.19044.2006]
>            Reporter: Jim Blye
>            Priority: Major
>         Attachments: commons-daemon.2022-09-28.log, 
> commons-daemon.2022-09-28_afterKillingServer.log, server.bat
>
>
> < *Update* . The reason the stop fails is because the start hasn't finished.  
> Prunsrv isn't waiting for the start to finish.  So in the Windows services 
> panel, the service appears to be started.  If you then click stop, it hangs 
> for a few minutes and fails to stop.  The state at this point in the Windows 
> services is "Stopping".  So you have to manually stop the process. >
> When Prunsrv is used to register Open Liberty 
> ([https://openliberty.io|https://openliberty.io/]) as a Windows Service, 
> stopping the service hangs randomly.
> *To recreate the problem:*
>   1) Download open liberty  ~300MB
>            
> [https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/22.0.0.10/openliberty-22.0.0.10.zip]
>       Alternatively, you could use just the liberty kernel ~10MB
>           
> [https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/22.0.0.10/openliberty-kernel-22.0.0.10.zip]
>   2) md C:\temp\openliberty
>        unzip openliberty-22.0.0.10.zip into C:\temp\openliberty
>   3) cd C:\temp\openliberty\wlp\bin
>   4) Run these two commands to make sure the server runs and to initialize 
> the environment:
>        server start
>        server stop
>    5) Register liberty as a service (parameter is case sensitive).  The 
> following command is used to invoke prunsrv to register the service using the 
> default name of defaultServer
>         server registerWinService
>     6)  Open the windows "services" app (services.msc).   Start and stop the 
> service until the stop hangs.  It usually doesn't take more than a couple of 
> tries.
>  
> *Details*
> The *server.bat* script registers the service like this:
> "C:\temp\openliberty\wlp\bin\tools\win\prunsrv.exe"  //IS//defaultServer 
> --Startup=manual --DisplayName="defaultServer" --Description="Open Liberty" 
> ++DependsOn=Tcpip 
> --LogPath="C:\temp\openliberty\wlp\usr\servers\defaultServer\logs" 
> --StdOutput=auto --StdError=auto --StartMode=exe 
> --StartPath="C:\temp\openliberty\wlp" 
> --StartImage="C:\temp\openliberty\wlp\bin\server.bat" 
> ++StartParams=start#defaultServer --StopMode=exe 
> --StopPath="C:\temp\openliberty\wlp" --StopImage="C:\temp\wlp\bin\server.bat" 
> ++StopParams=stop#defaultServer --ServiceUser=LocalSystem
> After registering the service you can look at its properties.  You will see:
>    Path to executable:
>    C:\temp\openliberty\wlp\bin\tools\win\prunsrv.exe //RS//defaultServer
> When I (and many of our customers) try to stop the service, it hangs.   At 
> that point, the server, named defaultServer is still up and running.  I can 
> send commands to the server.  For instance, I can execute a "server dump" 
> command. This sends the "dump" command to the server, and the server writes 
> information to a file.  I can also stop the server by executing "server 
> stop".  This sends the "stop" command to the server which causes the server 
> to stop.  When the server stops, the hanging Windows service stops as well.
> I have attached a *server.bat* which adds --LogLevel Debug to the prunsrv 
> commands and also *commons-daemon.2022-09-28.log* which demonstrates the 
> problem. It shows registering, starting, and stopping the service.  Finally, 
> I uploaded {*}commons-daemon.2022-09-28_afterKillingServer.log{*}, which is a 
> continuation of the other log file which shows the result of issuing the 
> server stop command to stop the server.
> Thanks for looking at this.
> Jim Blye



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to