Uploaded image for project: 'Commons Daemon'
  1. Commons Daemon
  2. DAEMON-449

Prunsrv fails to stop Open Liberty Windows service

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 1.2.2
    • None
    • prunsrv
    • None
    • I don't think the Windows version matters, but I am using:
      Microsoft Windows [Version 10.0.19044.2006]

    Description

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

      Attachments

        1. commons-daemon.2022-09-28.log
          6 kB
          Jim Blye
        2. server.bat
          29 kB
          Jim Blye
        3. commons-daemon.2022-09-28_afterKillingServer.log
          9 kB
          Jim Blye

        Activity

          People

            Unassigned Unassigned
            jimblye Jim Blye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: