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

Maven build hangs when trying to fetch external resources.

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • maven-plugin
    • None
    • Platform: PC, OS: Windows XP

      I know this have been reported before, but I though I'd fill in with some
      additional information.

      I am trying to build our Maven2 multi project with Hudson, but it just hangs
      while trying to fetch artifacts from external repositories. The same build works
      fine from the commandline.

      I tried with Maven 2.0.4, Maven 2.0.6 and Maven 2.0.7 all with the same result.

      Here is what the console log shows:

      $ java -cp "C:\Documents and Settings\bjacobse\Local
      Settings\Temp\winstone\hudson.war\WEB-INF\lib\maven-agent-1.150.jar;C:\Program
      Files\maven-2.0.4\core\boot\classworlds-1.1.jar" hudson.maven.agent.Main
      "C:\Program Files\maven-2.0.4" "C:\Documents and Settings\bjacobse\Local
      Settings\Temp\winstone\hudson.war\WEB-INF\lib\remoting-1.150.jar" "C:\Documents
      and Settings\bjacobse\Local
      Settings\Temp\winstone\hudson.war\WEB-INF\lib\maven-interceptor-1.150.jar"
      channel started
      [INFO] Scanning for projects...
      [INFO] Reactor build order:
      [INFO] ip-functions
      [INFO] ip-code-translator
      [INFO] ip-code-service-rar
      [INFO] ip-code-service-ws
      [INFO] ip-exceptions
      [INFO] ip-logging
      [INFO] ip-logging-servlet
      [INFO] ip-soapfault-interpreter
      [INFO] ip-errorhandler-logging
      [INFO] ip-errorhandler
      [INFO] ip-bulls-logservice
      [INFO] ip-bulls-eventservice
      [INFO] ip-test-tse-logging
      [INFO] ip-testservice
      [INFO] test-webservices
      [INFO] bulls-webservices
      [INFO] ip-code-translator-rar
      [INFO] ip-alsb-logging
      Downloading:
      http://repo1.maven.org/maven2/org/apache/axis2/maven2/axis2-aar-maven-plugin/1.1/axis2-aar-maven-plugin-1.1.pom

      When I then eventually abort the job I get this stacktrace:

      ERROR: Aborted
      java.lang.InterruptedException
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Object.java:485)
      at hudson.remoting.Request.call(Request.java:88)
      at hudson.remoting.Channel.call(Channel.java:272)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:309)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:192)
      at hudson.model.Run.run(Run.java:601)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:172)
      at hudson.model.ResourceController.execute(ResourceController.java:70)
      at hudson.model.Executor.run(Executor.java:62)
      finished: FAILURE

          [JENKINS-976] Maven build hangs when trying to fetch external resources.

          bjacobse added a comment -

          I have no idea what is interesting for you, but here is most of the info from
          JConsole:

          Name: TCP slave agent listener port=0
          State: RUNNABLE
          Total blocked: 0 Total waited: 0

          Stack trace:
          java.net.PlainSocketImpl.socketAccept(Native Method)
          java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)

          • locked java.net.SocksSocketImpl@4d1082
            java.net.ServerSocket.implAccept(ServerSocket.java:453)
            java.net.ServerSocket.accept(ServerSocket.java:421)
            hudson.TcpSlaveAgentListener.run(TcpSlaveAgentListener.java:96)

          Name: Thread-2
          State: TIMED_WAITING on java.util.LinkedHashSet@ffc3eb
          Total blocked: 0 Total waited: 13

          Stack trace:
          java.lang.Object.wait(Native Method)
          hudson.model.ViewJob$ReloadThread.getNext(ViewJob.java:136)
          hudson.model.ViewJob$ReloadThread.run(ViewJob.java:152)

          Name: Executor #0 for master
          State: WAITING on hudson.remoting.UserRequest@3d2e6c
          Total blocked: 4 Total waited: 5

          Stack trace:
          java.lang.Object.wait(Native Method)
          java.lang.Object.wait(Object.java:485)
          hudson.remoting.Request.call(Request.java:88)
          hudson.remoting.Channel.call(Channel.java:272)
          hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:309)
          hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:192)
          hudson.model.Run.run(Run.java:601)
          hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:172)
          hudson.model.ResourceController.execute(ResourceController.java:70)
          hudson.model.Executor.run(Executor.java:62)

          Name: Executor #1 for master
          State: WAITING on hudson.util.OneShotEvent@1cf4353
          Total blocked: 2 Total waited: 2

          Stack trace:
          java.lang.Object.wait(Native Method)
          java.lang.Object.wait(Object.java:485)
          hudson.util.OneShotEvent.block(OneShotEvent.java:28)
          hudson.model.Queue.pop(Queue.java:349)
          hudson.model.Executor.run(Executor.java:54)

          Name: Hudson cron thread
          State: TIMED_WAITING on java.util.TaskQueue@93bca2
          Total blocked: 0 Total waited: 17

          Stack trace:
          java.lang.Object.wait(Native Method)
          java.util.TimerThread.mainLoop(Timer.java:509)
          java.util.TimerThread.run(Timer.java:462)

          Name: RMI Scheduler(0)
          State: TIMED_WAITING on
          java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@75c78d
          Total blocked: 0 Total waited: 5

          Stack trace:
          sun.misc.Unsafe.park(Native Method)
          java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
          java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos
          (AbstractQueuedSynchronizer.java:1963)
          java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
          java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take
          (ScheduledThreadPoolExecutor.java:582)
          java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take
          (ScheduledThreadPoolExecutor.java:575)
          java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:946)
          java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906)
          java.lang.Thread.run(Thread.java:619)

          Name: RMI TCP Connection(9)-169.254.2.2
          State: RUNNABLE
          Total blocked: 1 Total waited: 1

          Stack trace:
          java.net.SocketInputStream.socketRead0(Native Method)
          java.net.SocketInputStream.read(SocketInputStream.java:129)
          java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
          java.io.BufferedInputStream.read(BufferedInputStream.java:237)

          • locked java.io.BufferedInputStream@a40b04
            java.io.FilterInputStream.read(FilterInputStream.java:66)
            sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:517)
            sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
            sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
            java.util.concurrent.ThreadPoolExecutor$Worker.runTask
            (ThreadPoolExecutor.java:885)
            java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
            java.lang.Thread.run(Thread.java:619)

          Name: RequestHandlerThread4
          State: RUNNABLE
          Total blocked: 0 Total waited: 17

          Stack trace:
          java.net.SocketInputStream.socketRead0(Native Method)
          java.net.SocketInputStream.read(SocketInputStream.java:129)
          java.net.SocketInputStream.read(SocketInputStream.java:182)
          winstone.WinstoneInputStream.read(WinstoneInputStream.java:51)
          javax.servlet.ServletInputStream.readLine(ServletInputStream.java:27)
          winstone.WinstoneInputStream.readLine(WinstoneInputStream.java:82)
          winstone.HttpListener.parseURI(HttpListener.java:231)
          winstone.RequestHandlerThread.run(RequestHandlerThread.java:87)
          java.lang.Thread.run(Thread.java:619)

          Name: RequestHandlerThread3
          State: RUNNABLE
          Total blocked: 1 Total waited: 5

          Stack trace:
          java.net.SocketInputStream.socketRead0(Native Method)
          java.net.SocketInputStream.read(SocketInputStream.java:129)
          java.net.SocketInputStream.read(SocketInputStream.java:182)
          winstone.WinstoneInputStream.read(WinstoneInputStream.java:51)
          javax.servlet.ServletInputStream.readLine(ServletInputStream.java:27)
          winstone.WinstoneInputStream.readLine(WinstoneInputStream.java:82)
          winstone.HttpListener.parseURI(HttpListener.java:231)
          winstone.RequestHandlerThread.run(RequestHandlerThread.java:87)
          java.lang.Thread.run(Thread.java:619)

          ame: [Ljava.lang.String;@1da89a0: stderr copier
          State: RUNNABLE
          Total blocked: 0 Total waited: 0

          Stack trace:
          java.io.FileInputStream.readBytes(Native Method)
          java.io.FileInputStream.read(FileInputStream.java:177)
          hudson.util.StreamCopyThread.run(StreamCopyThread.java:27)

          Name: Channel reader thread: locally launched channel on [java, -Xdebug, -cp,
          C:\Documents and Settings\bjacobse\Local Settings\Temp\winstone\hudson.war\WEB-
          INF\lib\maven-agent-1.150.jar;C:\Program Files\maven-2.0.4
          \core\boot\classworlds-1.1.jar, hudson.maven.agent.Main, C:\Program Files\maven-
          2.0.4, C:\Documents and Settings\bjacobse\Local
          Settings\Temp\winstone\hudson.war\WEB-INF\lib\remoting-1.150.jar, C:\Documents
          and Settings\bjacobse\Local Settings\Temp\winstone\hudson.war\WEB-INF\lib\maven-
          interceptor-1.150.jar]
          State: RUNNABLE
          Total blocked: 0 Total waited: 0

          Stack trace:
          java.io.FileInputStream.readBytes(Native Method)
          java.io.FileInputStream.read(FileInputStream.java:199)
          java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
          java.io.BufferedInputStream.read(BufferedInputStream.java:237)

          • locked java.io.BufferedInputStream@1225fc1
            java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2247)
            java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2540)
            java.io.ObjectInputStream$BlockDataInputStream.peekByte
            (ObjectInputStream.java:2550)
            java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297)
            java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
            hudson.remoting.Channel$ReaderThread.run(Channel.java:446)

          bjacobse added a comment - I have no idea what is interesting for you, but here is most of the info from JConsole: Name: TCP slave agent listener port=0 State: RUNNABLE Total blocked: 0 Total waited: 0 Stack trace: java.net.PlainSocketImpl.socketAccept(Native Method) java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) locked java.net.SocksSocketImpl@4d1082 java.net.ServerSocket.implAccept(ServerSocket.java:453) java.net.ServerSocket.accept(ServerSocket.java:421) hudson.TcpSlaveAgentListener.run(TcpSlaveAgentListener.java:96) Name: Thread-2 State: TIMED_WAITING on java.util.LinkedHashSet@ffc3eb Total blocked: 0 Total waited: 13 Stack trace: java.lang.Object.wait(Native Method) hudson.model.ViewJob$ReloadThread.getNext(ViewJob.java:136) hudson.model.ViewJob$ReloadThread.run(ViewJob.java:152) Name: Executor #0 for master State: WAITING on hudson.remoting.UserRequest@3d2e6c Total blocked: 4 Total waited: 5 Stack trace: java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:485) hudson.remoting.Request.call(Request.java:88) hudson.remoting.Channel.call(Channel.java:272) hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:309) hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:192) hudson.model.Run.run(Run.java:601) hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:172) hudson.model.ResourceController.execute(ResourceController.java:70) hudson.model.Executor.run(Executor.java:62) Name: Executor #1 for master State: WAITING on hudson.util.OneShotEvent@1cf4353 Total blocked: 2 Total waited: 2 Stack trace: java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:485) hudson.util.OneShotEvent.block(OneShotEvent.java:28) hudson.model.Queue.pop(Queue.java:349) hudson.model.Executor.run(Executor.java:54) Name: Hudson cron thread State: TIMED_WAITING on java.util.TaskQueue@93bca2 Total blocked: 0 Total waited: 17 Stack trace: java.lang.Object.wait(Native Method) java.util.TimerThread.mainLoop(Timer.java:509) java.util.TimerThread.run(Timer.java:462) Name: RMI Scheduler(0) State: TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@75c78d Total blocked: 0 Total waited: 5 Stack trace: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos (AbstractQueuedSynchronizer.java:1963) java.util.concurrent.DelayQueue.take(DelayQueue.java:164) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:582) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (ScheduledThreadPoolExecutor.java:575) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:946) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906) java.lang.Thread.run(Thread.java:619) Name: RMI TCP Connection(9)-169.254.2.2 State: RUNNABLE Total blocked: 1 Total waited: 1 Stack trace: java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) java.io.BufferedInputStream.fill(BufferedInputStream.java:218) java.io.BufferedInputStream.read(BufferedInputStream.java:237) locked java.io.BufferedInputStream@a40b04 java.io.FilterInputStream.read(FilterInputStream.java:66) sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:517) sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:885) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) java.lang.Thread.run(Thread.java:619) Name: RequestHandlerThread 4 State: RUNNABLE Total blocked: 0 Total waited: 17 Stack trace: java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) java.net.SocketInputStream.read(SocketInputStream.java:182) winstone.WinstoneInputStream.read(WinstoneInputStream.java:51) javax.servlet.ServletInputStream.readLine(ServletInputStream.java:27) winstone.WinstoneInputStream.readLine(WinstoneInputStream.java:82) winstone.HttpListener.parseURI(HttpListener.java:231) winstone.RequestHandlerThread.run(RequestHandlerThread.java:87) java.lang.Thread.run(Thread.java:619) Name: RequestHandlerThread 3 State: RUNNABLE Total blocked: 1 Total waited: 5 Stack trace: java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) java.net.SocketInputStream.read(SocketInputStream.java:182) winstone.WinstoneInputStream.read(WinstoneInputStream.java:51) javax.servlet.ServletInputStream.readLine(ServletInputStream.java:27) winstone.WinstoneInputStream.readLine(WinstoneInputStream.java:82) winstone.HttpListener.parseURI(HttpListener.java:231) winstone.RequestHandlerThread.run(RequestHandlerThread.java:87) java.lang.Thread.run(Thread.java:619) ame: [Ljava.lang.String;@1da89a0: stderr copier State: RUNNABLE Total blocked: 0 Total waited: 0 Stack trace: java.io.FileInputStream.readBytes(Native Method) java.io.FileInputStream.read(FileInputStream.java:177) hudson.util.StreamCopyThread.run(StreamCopyThread.java:27) Name: Channel reader thread: locally launched channel on [java, -Xdebug, -cp, C:\Documents and Settings\bjacobse\Local Settings\Temp\winstone\hudson.war\WEB- INF\lib\maven-agent-1.150.jar;C:\Program Files\maven-2.0.4 \core\boot\classworlds-1.1.jar, hudson.maven.agent.Main, C:\Program Files\maven- 2.0.4, C:\Documents and Settings\bjacobse\Local Settings\Temp\winstone\hudson.war\WEB-INF\lib\remoting-1.150.jar, C:\Documents and Settings\bjacobse\Local Settings\Temp\winstone\hudson.war\WEB-INF\lib\maven- interceptor-1.150.jar] State: RUNNABLE Total blocked: 0 Total waited: 0 Stack trace: java.io.FileInputStream.readBytes(Native Method) java.io.FileInputStream.read(FileInputStream.java:199) java.io.BufferedInputStream.fill(BufferedInputStream.java:218) java.io.BufferedInputStream.read(BufferedInputStream.java:237) locked java.io.BufferedInputStream@1225fc1 java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2247) java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2540) java.io.ObjectInputStream$BlockDataInputStream.peekByte (ObjectInputStream.java:2550) java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297) java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) hudson.remoting.Channel$ReaderThread.run(Channel.java:446)

          In 1.175, I added a probe to Maven so that we can dump the stack through Hudson.
          When your build hangs, please go to the build page, and you'll see "Monitor
          Maven Process". From there, you should be able to get more information, in
          particular the stack dump.

          When you get that, please attach it here.

          Kohsuke Kawaguchi added a comment - In 1.175, I added a probe to Maven so that we can dump the stack through Hudson. When your build hangs, please go to the build page, and you'll see "Monitor Maven Process". From there, you should be able to get more information, in particular the stack dump. When you get that, please attach it here.

          bjacobse, that's the stack trace of the Hudson process. We need to see the stack
          trace of the Maven process.

          Kohsuke Kawaguchi added a comment - bjacobse, that's the stack trace of the Hudson process. We need to see the stack trace of the Maven process.

          mnk added a comment -

          Created an attachment (id=162)
          Stack-trace created on download-hang using "Monitor Maven Process"

          mnk added a comment - Created an attachment (id=162) Stack-trace created on download-hang using "Monitor Maven Process"

          mnk added a comment -

          The funny thing is, that the build gets out of the hang just after one of the
          "Monitor Maven Process" functions (e.g. "Thread Dump") are called. Even if the
          build requires several downloads, it just continues and completes successfully.
          I tried to create a thread-dump using jconsole, but it will not connect
          correctly to the maven sub-process. Jconsole connects to the main hudson process
          just fine.

          mnk added a comment - The funny thing is, that the build gets out of the hang just after one of the "Monitor Maven Process" functions (e.g. "Thread Dump") are called. Even if the build requires several downloads, it just continues and completes successfully. I tried to create a thread-dump using jconsole, but it will not connect correctly to the maven sub-process. Jconsole connects to the main hudson process just fine.

          tblack added a comment -

          Created an attachment (id=197)
          from delayed maven hangup

          tblack added a comment - Created an attachment (id=197) from delayed maven hangup

          tblack added a comment -

          I have a similar experience in Hudson 1.200, although the hang is not
          indefinite, it only lasts exactly two minutes. The resource maven was looking
          for was:
          Downloading:
          http://10.5.5.82:8081/artifactory/repo/org/apache/ws/commons/XmlSchema/1.1/XmlSchema-1.1.pom

          A few notes:
          1) outside of hudson, maven will spend less than a second on this download attempt
          2) we use a maven cache server, artifactory
          3) the <version> in the pom does not match the actual 1.1 version implied in the
          path. this is the reason why artifactory cannot handle the pom properly, so
          every maven run will attempt to download the pom ad nauseam.

          I captured the maven monitor thread dump during the 2 minute hangup and attached
          to this issue.

          tblack added a comment - I have a similar experience in Hudson 1.200, although the hang is not indefinite, it only lasts exactly two minutes. The resource maven was looking for was: Downloading: http://10.5.5.82:8081/artifactory/repo/org/apache/ws/commons/XmlSchema/1.1/XmlSchema-1.1.pom A few notes: 1) outside of hudson, maven will spend less than a second on this download attempt 2) we use a maven cache server, artifactory 3) the <version> in the pom does not match the actual 1.1 version implied in the path. this is the reason why artifactory cannot handle the pom properly, so every maven run will attempt to download the pom ad nauseam. I captured the maven monitor thread dump during the 2 minute hangup and attached to this issue.

          jergan added a comment -

          I am not sure that this is relevant, but I have problems with the maven
          assembly-plugin when running Maven projects using Hudson.
          When the plugin is to read the assembly descriptor xml file, located in the
          myproejct/src/assembler directory, Hudson hangs for several minutes.
          When running outside Hudson, this works without problems.
          The problem is reproducable.

          I use:

          • Hudson 1.205
          • Maven 2.0.8
          • JDK 1.6.0_01
          • Windows XP.

          (Running with this configuration, I also experience the problem that you
          describe (Hudson hangs when downloading artifacts).)

          jergan added a comment - I am not sure that this is relevant, but I have problems with the maven assembly-plugin when running Maven projects using Hudson. When the plugin is to read the assembly descriptor xml file, located in the myproejct/src/assembler directory, Hudson hangs for several minutes. When running outside Hudson, this works without problems. The problem is reproducable. I use: Hudson 1.205 Maven 2.0.8 JDK 1.6.0_01 Windows XP. (Running with this configuration, I also experience the problem that you describe (Hudson hangs when downloading artifacts).)

          karlmdavis added a comment -

          Created an attachment (id=246)
          This is the thread dump from my Maven2 build. It hangs while downloading a POM and never recovers. The hanging seems to happen at different POMs, randomly.

          karlmdavis added a comment - Created an attachment (id=246) This is the thread dump from my Maven2 build. It hangs while downloading a POM and never recovers. The hanging seems to happen at different POMs, randomly.

          I believe this is the same as issue #1458, which was fixed in Hudson 1.219.

              • This issue has been marked as a duplicate of 1458 ***

          Kohsuke Kawaguchi added a comment - I believe this is the same as issue #1458, which was fixed in Hudson 1.219. This issue has been marked as a duplicate of 1458 ***

            Unassigned Unassigned
            bjacobse bjacobse
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: