[ 
https://issues.apache.org/jira/browse/DAEMON-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17634413#comment-17634413
 ] 

Mark Thomas commented on DAEMON-449:
------------------------------------

I think you are mis-reading the logs.

The line
[2022-11-14 15:04:19] [debug] ( prunsrv.c:1603) [ 6136] Waiting for worker to 
finish...
shows that the service has started and the service wrapper is now waiting for 
the service to end before that thread will continue.

I suspect what is happening is that server.bat is returning before the service 
has fully started. Try adding some debug logging to show when server.bat exits.

> 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
>
>
> 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