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 <[email protected]>
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, <[email protected]> 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 <[email protected]>
> > 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?
> > >
> >
>

Reply via email to