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

Every message in slave log appears twice with the -slaveLog option

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Component/s: remoting
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      Running a local slave, launched using a command, with the -slaveLog option causes a log file to be written (as expected) with every message printed twice there, like this:

      channel startedchannel started
      
      channel stoppedchannel stopped
      
      

      (which is not expected).

      The launch script looks as follows (/home/matej/wc/jenkins is path to the Jenkins clone):

      #!/bin/bash --norc
      export TMP=$(mktemp -d --tmpdir jenkins-XXXXX)
      SLAVEJAR_URL=http://localhost:8080/jenkins/jnlpJars/slave.jar
      wget -q "${SLAVEJAR_URL:?}" -P "${TMP:?}" 2>&1
      _log_dir=/home/matej/wc/jenkins/work/logs
      mkdir -p "$_log_dir"
      _log=$(mktemp -u "$_log_dir/$(date -u +%Y%m%d-%H%M%S)-XXX")
      export JAVA_HOME=/usr/lib/jvm/java-7-oracle
      "$JAVA_HOME"/bin/java -jar "$TMP"/slave.jar \
                            -slaveLog "$_log"
      

      I wondered whether it is just the messages that gets duplicated (perhaps caused by the TeeOutputStream created by the Launcher effectively outputting twice to the identical output stream) or if it is the threads calling Launcher.run() (I cannot imagine how that could happen).

        Attachments

          Issue Links

            Activity

            Hide
            mkorvas Matěj Korvas added a comment -

            I have removed the note about potentially related issue of slaves failing to start. It turned out to be solvable by using the -text argument to slave.jar, while messages continue to be printed twice in slave logs.

            Show
            mkorvas Matěj Korvas added a comment - I have removed the note about potentially related issue of slaves failing to start. It turned out to be solvable by using the -text argument to slave.jar , while messages continue to be printed twice in slave logs.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            slaveLog redirects only the STDERR stream, so it should not happen. In the original request the example shows two different messages. Will check if it happens on my instance

            Show
            oleg_nenashev Oleg Nenashev added a comment - slaveLog redirects only the STDERR stream, so it should not happen. In the original request the example shows two different messages. Will check if it happens on my instance
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            JENKINS-39369 should solve this issue as well by providing a better log management option

            Show
            oleg_nenashev Oleg Nenashev added a comment - JENKINS-39369 should solve this issue as well by providing a better log management option
            Hide
            jthompson Jeff Thompson added a comment -

            I don't see any indication in any recent logs, including many I've been recently examining, that this still occurs. I'm going to go ahead and close this issue. If it still occurs then re-open with additional reproduction information.

            Show
            jthompson Jeff Thompson added a comment - I don't see any indication in any recent logs, including many I've been recently examining, that this still occurs. I'm going to go ahead and close this issue. If it still occurs then re-open with additional reproduction information.
            Hide
            mkorvas Matěj Korvas added a comment -

            Thanks for getting back to this. I am happy to believe that it was solved by Oleg's changes as commented above. If I happen to observe the erroneous behaviour again with a recent Jenkins version, I will update this ticket as suggested.

            Show
            mkorvas Matěj Korvas added a comment - Thanks for getting back to this. I am happy to believe that it was solved by Oleg's changes as commented above. If I happen to observe the erroneous behaviour again with a recent Jenkins version, I will update this ticket as suggested.

              People

              • Assignee:
                Unassigned
                Reporter:
                mkorvas Matěj Korvas
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: