Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7937

debian init.d script needs to sleep during a restart command

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      Ubuntu 10.04
      Hudson 1.381
    • Similar Issues:

      Description

      Hudson does not restart properly when calling "/etc/init.d/hudson restart". When it calls "do_start" java hasn't let go of port 8080 so the restart fails. The solution is to sleep for 2 seconds between stopping and starting:

       
        restart|force-reload)
          #   
          # If the "reload" option is implemented then remove the
          # 'force-reload' alias
          #   
          log_daemon_msg "Restarting $DESC" "$NAME"
          do_stop
          sleep 2 # wait for java to release the port !!
          case "$?" in
            0|1)
              do_start
              case "$?" in
                0) log_end_msg 0 ;;
                1) log_end_msg 1 ;; # Old process is still running
                *) log_end_msg 1 ;; # Failed to start
              esac
              ;;  
            *)  
              # Failed to stop
              log_end_msg 1
              ;;  
          esac
          ;;  
      

        Attachments

          Activity

          Hide
          kohsuke Kohsuke Kawaguchi added a comment -

          Fixed in 1.388 as https://github.com/hudson/hudson/commit/1168ddff5da6e2f84065949200b1ce92fd207d1d

          Sleeping a fixed amount of time is obviously not the right approach , so instead I modified the script to poll for the termination of the process.

          Show
          kohsuke Kohsuke Kawaguchi added a comment - Fixed in 1.388 as https://github.com/hudson/hudson/commit/1168ddff5da6e2f84065949200b1ce92fd207d1d Sleeping a fixed amount of time is obviously not the right approach , so instead I modified the script to poll for the termination of the process.
          Hide
          tjwallace tjwallace added a comment -

          Yes good call on waiting for the process to actually terminate. Thanks kohsuke!

          Show
          tjwallace tjwallace added a comment - Yes good call on waiting for the process to actually terminate. Thanks kohsuke!

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tjwallace tjwallace
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: