Hi,
Following is my test class that starts a notepad process from within:
" public void startProcessNotepad() throws IOException {
                Process p = Runtime.getRuntime().exec("notepad");
                System.out.println("....NOTEPAD STARTED....");
        }
"

When I execute this test through maven using "mvn test" through the
surefire plugin, maven does not exit until the notepad process is
closed/terminated. 
I have attached the thread dump long along with this mail. Please look
into it and let me know if there is a way to work around this. I will
want to be starting a server process in one of my test cases and wants
maven to continue with other builds for whose test cases, the server
needs to be running.

Thanks for any help,
Ravi

-----Original Message-----
From: Jerome Lacoste [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 19, 2007 9:37 PM
To: Maven Users List
Subject: Re: Starting a new java process from within a test case is
hanging the maven JVM

On 4/19/07, Balasubramanian, Ravi Shankar <[EMAIL PROTECTED]>
wrote:
> Hi all,
> I did work on this and found that maven's java process is not waiting
> until all other processes started during the build is completed /
> terminated. Following is what I did:
>
> In one of my test cases, I start a new process using the java Runtime
> class. For experimentation I executed the command "notepad" on windows
> which would start a separate process for me. The test case is as
> follows:
> Process p = Runtime.getRuntime().exec("notepad");
>
> When I do a mvn test, the java process started by the maven build does
> not exit until the notepad is closed or terminated.
>
> Is there a way or configuration in maven to work around such a setting
> or is maven designed like this? I might want to be starting a server
> like process in one of my test cases and would want maven to complete
> the build which currently is not happening.

Again, can you provide a thread dump log ?

That will help us identify where maven hangs, and help us give you an
answer.

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running start Notepad
....NOTEPAD STARTED....
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.172 sec

Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
<<<<IT HANGS AT THIS POINT AND DOES NOT EXIT UNTIL THE NOTEPAD PROCSS IS 
CLOSED>>>

Full thread dump Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode, sharing):

"Thread-2" prio=5 tid=0x033cfe30 nid=0xf8c runnable [0x041df000..0x041dfb64]
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:194)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
        - locked <0x24152be8> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        - locked <0x24152be8> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at org.codehaus.plexus.util.cli.StreamPumper.run(StreamPumper.java:139)

"Thread-1" prio=5 tid=0x033091b8 nid=0xde8 runnable [0x0419f000..0x0419fbe4]
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:194)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:254)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
        - locked <0x2414dd20> (a java.io.BufferedInputStream)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
        - locked <0x24150110> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        - locked <0x24150110> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at org.codehaus.plexus.util.cli.StreamPumper.run(StreamPumper.java:152)

"Low Memory Detector" daemon prio=5 tid=0x00a70f58 nid=0xa90 runnable [0x0000000
0..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x00a6fb08 nid=0x11ec waiting on condition
[0x00000000..0x02d4f848]

"Signal Dispatcher" daemon prio=10 tid=0x00a6ed30 nid=0x12a0 waiting on conditio
n [0x00000000..0x00000000]

"Finalizer" daemon prio=9 tid=0x00a695f8 nid=0x1244 in Object.wait() [0x02ccf000
..0x02ccfc64]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x245324f0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0x245324f0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00a688f8 nid=0xaec in Object.wait() [0x
02c8f000..0x02c8fce4]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x24532570> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:474)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
        - locked <0x24532570> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x00237d20 nid=0x5fc in Object.wait() [0x0006f000..0x0006fc3c]

        at java.lang.Object.wait(Native Method)
        - waiting on <0x2414fef0> (a org.codehaus.plexus.util.cli.StreamPumper)
        at java.lang.Object.wait(Object.java:474)
        at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(Comm
andLineUtils.java:117)
        - locked <0x2414fef0> (a org.codehaus.plexus.util.cli.StreamPumper)
        at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(Comm
andLineUtils.java:60)
        at org.apache.maven.surefire.booter.SurefireBooter.fork(SurefireBooter.j
ava:484)
        at org.apache.maven.surefire.booter.SurefireBooter.forkSuites(SurefireBo
oter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesForkOnce(Sur
efireBooter.java:245)
        at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.ja
va:143)
        at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugi
n.java:376)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:412)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:534)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:475)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:454)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:306)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:273)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

"VM Thread" prio=10 tid=0x00a47050 nid=0xb74 runnable

"VM Periodic Task Thread" prio=10 tid=0x00a72598 nid=0x268 waiting on condition
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to