You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Debraj Manna <su...@gmail.com> on 2019/12/09 02:40:19 UTC

Re: Take threaddump on hung surefire tests

No Tibor.  I am not getting much time to spend on this. For new classes i
have been using Timeout rule for now.

One more question in a multi-module project is it possible to fail the
build immediately when timeout is reached and in other failure cases fail
in the end. I am using Jenkins so here fail-on-end is set to true. Is it
possible to do this?


On Fri, 22 Nov 2019, 02:51 Tibor Digana, <ti...@apache.org> wrote:

> Hi Debraj,
>
> It's over one month when you wrote this email.
> How did you solve this issue, did you find the real root cause?
> Let us know how you are doing, thx!
> btw, we released the new version 3.0.0-M4 in Nov/17.
>
> Cheers
> Tibor17
>
>
>
> On Thu, Oct 3, 2019 at 2:49 PM Debraj Manna <su...@gmail.com>
> wrote:
>
> > Sometimes I have maven surefire tests that get hung, due to either races
> or
> > deadlocks.
> >
> > When this happens I have to discover what slave is being used, and then I
> > have to log on that slave, sudo to jenkins account and execute either
> > jstack or kill -3
> >
> > I am looking for a simple solution like doing jstack / kill -3 when
> someone
> > presses abort button on the jenkins.
> >
> > Can someone suggest how can I automate this or some better way of
> handling
> > this?
> >
>

Re: Take threaddump on hung surefire tests

Posted by Tibor Digana <ti...@apache.org>.
This thread dump already exists in the version 3.0.0-M4.
https://github.com/apache/maven-surefire/blob/master/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java#L283
See the dump file for the particular JVM in /target/surefire-reports

On Mon, Dec 9, 2019 at 6:29 PM Debraj Manna <su...@gmail.com>
wrote:

> Thanks again Tibor.
>
> One more question is it possible to get a thread dump before failing the
> build when forkedProcessTimeoutInSeconds
> <
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds
> >
> is
> reached?
>
> On Mon, Dec 9, 2019 at 4:38 PM Tibor Digana <ti...@apache.org>
> wrote:
>
> >  fixed typo:If your Jenkins sends SIGKILL to the Maven process then
> enable
> > the process checker, see more details in the documentaion:
> >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
> >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker
> >
> > On Mon, Dec 9, 2019 at 12:01 PM Tibor Digana <ti...@apache.org>
> > wrote:
> >
> > > Hi Debraj,
> > >
> > > >> to fail the build immediately when timeout is reached
> > >
> > > This feature exists for years:
> > >
> > >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds
> > >
> > >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#forkedProcessTimeoutInSeconds
> > >
> > > >> to fail the ... when someone presses abort button on the jenkins
> > >
> > > This also exists with several alternatives (changed across the
> versions).
> > > See the detailed page
> > >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html
> > >
> > > If your Jenkins sends the SIGTERM signal into the Maven process (same
> as
> > > CTRL+C) then the standard input stream in process pipe becomes closed
> and
> > > the EOFException is caugh byt the forked JVM and shutdown is called:
> > >
> > >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#shutdown
> > >
> > >
> >
> maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#shutdown
> > > If you want to kill the JVM, you can reconfigure the default behavior.
> > >
> > > If your Jenkins sends SIGTERM to the Maven process then enable the
> > process
> > > checker, see more details in the documentaion:
> > >
> > >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
> > >
> > >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker
> > >
> > > Did it help?
> > >
> > > Here is the FAQ:
> > > http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html
> > >
> > > Feel free to ask any questions if you have a problem with this topic.
> > >
> > >
> > > Cheers
> > > Tibor17
> > >
> > >
> > > On Mon, Dec 9, 2019 at 3:40 AM Debraj Manna <su...@gmail.com>
> > > wrote:
> > >
> > >> No Tibor.  I am not getting much time to spend on this. For new
> classes
> > i
> > >> have been using Timeout rule for now.
> > >>
> > >> One more question in a multi-module project is it possible to fail the
> > >> build immediately when timeout is reached and in other failure cases
> > fail
> > >> in the end. I am using Jenkins so here fail-on-end is set to true. Is
> it
> > >> possible to do this?
> > >>
> > >>
> > >> On Fri, 22 Nov 2019, 02:51 Tibor Digana, <ti...@apache.org>
> > wrote:
> > >>
> > >> > Hi Debraj,
> > >> >
> > >> > It's over one month when you wrote this email.
> > >> > How did you solve this issue, did you find the real root cause?
> > >> > Let us know how you are doing, thx!
> > >> > btw, we released the new version 3.0.0-M4 in Nov/17.
> > >> >
> > >> > Cheers
> > >> > Tibor17
> > >> >
> > >> >
> > >> >
> > >> > On Thu, Oct 3, 2019 at 2:49 PM Debraj Manna <
> subharaj.manna@gmail.com
> > >
> > >> > wrote:
> > >> >
> > >> > > Sometimes I have maven surefire tests that get hung, due to either
> > >> races
> > >> > or
> > >> > > deadlocks.
> > >> > >
> > >> > > When this happens I have to discover what slave is being used, and
> > >> then I
> > >> > > have to log on that slave, sudo to jenkins account and execute
> > either
> > >> > > jstack or kill -3
> > >> > >
> > >> > > I am looking for a simple solution like doing jstack / kill -3
> when
> > >> > someone
> > >> > > presses abort button on the jenkins.
> > >> > >
> > >> > > Can someone suggest how can I automate this or some better way of
> > >> > handling
> > >> > > this?
> > >> > >
> > >> >
> > >>
> > >
> >
>

Re: Take threaddump on hung surefire tests

Posted by Debraj Manna <su...@gmail.com>.
Thanks again Tibor.

One more question is it possible to get a thread dump before failing the
build when forkedProcessTimeoutInSeconds
<http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds>
is
reached?

On Mon, Dec 9, 2019 at 4:38 PM Tibor Digana <ti...@apache.org> wrote:

>  fixed typo:If your Jenkins sends SIGKILL to the Maven process then enable
> the process checker, see more details in the documentaion:
>
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
>
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker
>
> On Mon, Dec 9, 2019 at 12:01 PM Tibor Digana <ti...@apache.org>
> wrote:
>
> > Hi Debraj,
> >
> > >> to fail the build immediately when timeout is reached
> >
> > This feature exists for years:
> >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds
> >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#forkedProcessTimeoutInSeconds
> >
> > >> to fail the ... when someone presses abort button on the jenkins
> >
> > This also exists with several alternatives (changed across the versions).
> > See the detailed page
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html
> >
> > If your Jenkins sends the SIGTERM signal into the Maven process (same as
> > CTRL+C) then the standard input stream in process pipe becomes closed and
> > the EOFException is caugh byt the forked JVM and shutdown is called:
> >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#shutdown
> >
> >
> maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#shutdown
> > If you want to kill the JVM, you can reconfigure the default behavior.
> >
> > If your Jenkins sends SIGTERM to the Maven process then enable the
> process
> > checker, see more details in the documentaion:
> >
> >
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
> >
> >
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker
> >
> > Did it help?
> >
> > Here is the FAQ:
> > http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html
> >
> > Feel free to ask any questions if you have a problem with this topic.
> >
> >
> > Cheers
> > Tibor17
> >
> >
> > On Mon, Dec 9, 2019 at 3:40 AM Debraj Manna <su...@gmail.com>
> > wrote:
> >
> >> No Tibor.  I am not getting much time to spend on this. For new classes
> i
> >> have been using Timeout rule for now.
> >>
> >> One more question in a multi-module project is it possible to fail the
> >> build immediately when timeout is reached and in other failure cases
> fail
> >> in the end. I am using Jenkins so here fail-on-end is set to true. Is it
> >> possible to do this?
> >>
> >>
> >> On Fri, 22 Nov 2019, 02:51 Tibor Digana, <ti...@apache.org>
> wrote:
> >>
> >> > Hi Debraj,
> >> >
> >> > It's over one month when you wrote this email.
> >> > How did you solve this issue, did you find the real root cause?
> >> > Let us know how you are doing, thx!
> >> > btw, we released the new version 3.0.0-M4 in Nov/17.
> >> >
> >> > Cheers
> >> > Tibor17
> >> >
> >> >
> >> >
> >> > On Thu, Oct 3, 2019 at 2:49 PM Debraj Manna <subharaj.manna@gmail.com
> >
> >> > wrote:
> >> >
> >> > > Sometimes I have maven surefire tests that get hung, due to either
> >> races
> >> > or
> >> > > deadlocks.
> >> > >
> >> > > When this happens I have to discover what slave is being used, and
> >> then I
> >> > > have to log on that slave, sudo to jenkins account and execute
> either
> >> > > jstack or kill -3
> >> > >
> >> > > I am looking for a simple solution like doing jstack / kill -3 when
> >> > someone
> >> > > presses abort button on the jenkins.
> >> > >
> >> > > Can someone suggest how can I automate this or some better way of
> >> > handling
> >> > > this?
> >> > >
> >> >
> >>
> >
>

Re: Take threaddump on hung surefire tests

Posted by Tibor Digana <ti...@apache.org>.
 fixed typo:If your Jenkins sends SIGKILL to the Maven process then enable
the process checker, see more details in the documentaion:
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker

On Mon, Dec 9, 2019 at 12:01 PM Tibor Digana <ti...@apache.org> wrote:

> Hi Debraj,
>
> >> to fail the build immediately when timeout is reached
>
> This feature exists for years:
>
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds
>
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#forkedProcessTimeoutInSeconds
>
> >> to fail the ... when someone presses abort button on the jenkins
>
> This also exists with several alternatives (changed across the versions).
> See the detailed page
> http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html
>
> If your Jenkins sends the SIGTERM signal into the Maven process (same as
> CTRL+C) then the standard input stream in process pipe becomes closed and
> the EOFException is caugh byt the forked JVM and shutdown is called:
>
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#shutdown
>
> maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#shutdown
> If you want to kill the JVM, you can reconfigure the default behavior.
>
> If your Jenkins sends SIGTERM to the Maven process then enable the process
> checker, see more details in the documentaion:
>
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
>
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker
>
> Did it help?
>
> Here is the FAQ:
> http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html
>
> Feel free to ask any questions if you have a problem with this topic.
>
>
> Cheers
> Tibor17
>
>
> On Mon, Dec 9, 2019 at 3:40 AM Debraj Manna <su...@gmail.com>
> wrote:
>
>> No Tibor.  I am not getting much time to spend on this. For new classes i
>> have been using Timeout rule for now.
>>
>> One more question in a multi-module project is it possible to fail the
>> build immediately when timeout is reached and in other failure cases fail
>> in the end. I am using Jenkins so here fail-on-end is set to true. Is it
>> possible to do this?
>>
>>
>> On Fri, 22 Nov 2019, 02:51 Tibor Digana, <ti...@apache.org> wrote:
>>
>> > Hi Debraj,
>> >
>> > It's over one month when you wrote this email.
>> > How did you solve this issue, did you find the real root cause?
>> > Let us know how you are doing, thx!
>> > btw, we released the new version 3.0.0-M4 in Nov/17.
>> >
>> > Cheers
>> > Tibor17
>> >
>> >
>> >
>> > On Thu, Oct 3, 2019 at 2:49 PM Debraj Manna <su...@gmail.com>
>> > wrote:
>> >
>> > > Sometimes I have maven surefire tests that get hung, due to either
>> races
>> > or
>> > > deadlocks.
>> > >
>> > > When this happens I have to discover what slave is being used, and
>> then I
>> > > have to log on that slave, sudo to jenkins account and execute either
>> > > jstack or kill -3
>> > >
>> > > I am looking for a simple solution like doing jstack / kill -3 when
>> > someone
>> > > presses abort button on the jenkins.
>> > >
>> > > Can someone suggest how can I automate this or some better way of
>> > handling
>> > > this?
>> > >
>> >
>>
>

Re: Take threaddump on hung surefire tests

Posted by Tibor Digana <ti...@apache.org>.
Hi Debraj,

>> to fail the build immediately when timeout is reached

This feature exists for years:
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds
http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#forkedProcessTimeoutInSeconds

>> to fail the ... when someone presses abort button on the jenkins

This also exists with several alternatives (changed across the versions).
See the detailed page
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html

If your Jenkins sends the SIGTERM signal into the Maven process (same as
CTRL+C) then the standard input stream in process pipe becomes closed and
the EOFException is caugh byt the forked JVM and shutdown is called:
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#shutdown
maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#shutdown
If you want to kill the JVM, you can reconfigure the default behavior.

If your Jenkins sends SIGTERM to the Maven process then enable the process
checker, see more details in the documentaion:
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker
http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker

Did it help?

Here is the FAQ:
http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html

Feel free to ask any questions if you have a problem with this topic.


Cheers
Tibor17


On Mon, Dec 9, 2019 at 3:40 AM Debraj Manna <su...@gmail.com>
wrote:

> No Tibor.  I am not getting much time to spend on this. For new classes i
> have been using Timeout rule for now.
>
> One more question in a multi-module project is it possible to fail the
> build immediately when timeout is reached and in other failure cases fail
> in the end. I am using Jenkins so here fail-on-end is set to true. Is it
> possible to do this?
>
>
> On Fri, 22 Nov 2019, 02:51 Tibor Digana, <ti...@apache.org> wrote:
>
> > Hi Debraj,
> >
> > It's over one month when you wrote this email.
> > How did you solve this issue, did you find the real root cause?
> > Let us know how you are doing, thx!
> > btw, we released the new version 3.0.0-M4 in Nov/17.
> >
> > Cheers
> > Tibor17
> >
> >
> >
> > On Thu, Oct 3, 2019 at 2:49 PM Debraj Manna <su...@gmail.com>
> > wrote:
> >
> > > Sometimes I have maven surefire tests that get hung, due to either
> races
> > or
> > > deadlocks.
> > >
> > > When this happens I have to discover what slave is being used, and
> then I
> > > have to log on that slave, sudo to jenkins account and execute either
> > > jstack or kill -3
> > >
> > > I am looking for a simple solution like doing jstack / kill -3 when
> > someone
> > > presses abort button on the jenkins.
> > >
> > > Can someone suggest how can I automate this or some better way of
> > handling
> > > this?
> > >
> >
>