WildFly
  1. WildFly
  2. WFLY-797

jboss-as-arquillian-container-managed: the manager server keeps running if @RunAsClient testcase has been stopped. It should be set as a daemon process.

    Details

    • Type: Bug Bug
    • Status: Open Open (View Workflow)
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Test Suite
    • Security Level: Public (Everyone can see)
    • Labels:
      None
    • Environment:
      JDK 1.6, Linux (Ubuntu 10.10), JBoss AS 7.1.1, IntelliJ 11.1.1
    • Similar Issues:
      Show 10 results 

      Description

      To reproduce with IntelliJ:

      • Create a @RunAsClient testcase for a managed server.
      • Put a breakpoint in it
      • Debug the test case so it stops on the breakpoint, with IntelliJ
      • Hit the "stop" button (a red square), also known as a soft kill. Note that this is not the "Exit" button, also known as a hard kill.
      • Open your system monitor, notice that the managed server process is still running.

      If you start the testcase again now, you get:

      org.jboss.arquillian.container.spi.client.container.LifecycleException: The server is already running! Managed containers does not support connecting to running server instances due to the possible harmful effect of connecting to the wrong server. Please stop server before running or change to another type of container.
      To disable this check and allow Arquillian to connect to a running server, set allowConnectingToRunningServer to true in the container configuration
      	at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.failDueToRunning(ManagedDeployableContainer.java:209)
      	at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:70)
      	at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:113)
      	at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:198)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221)
      	at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
      	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      

        Activity

        Hide
        Geoffrey De Smet
        added a comment -

        I might be wrong about the soft/hard kills.
        This post seems to suggest it's the other way around:
        http://stackoverflow.com/questions/4727536/how-do-i-stop-a-processing-running-in-intellij-such-that-it-calls-the-shutdown-h

        "stop" = hard kill
        "exit" = soft kill

        If that post is correct, this issue might be unfixable. Even polling approaches would fail as debugging will make the client looks like it's dead (even if it isn't).

        Show
        Geoffrey De Smet
        added a comment - I might be wrong about the soft/hard kills. This post seems to suggest it's the other way around: http://stackoverflow.com/questions/4727536/how-do-i-stop-a-processing-running-in-intellij-such-that-it-calls-the-shutdown-h "stop" = hard kill "exit" = soft kill If that post is correct, this issue might be unfixable. Even polling approaches would fail as debugging will make the client looks like it's dead (even if it isn't).
        Hide
        Geoffrey De Smet
        added a comment -

        On linux (and I am on linux), this should work "You have to make the sub processes daemonic in order to have them killed when the father is killed (or dies), otherwise they are adopted by init(1).": http://stackoverflow.com/questions/1491674/when-a-parent-process-is-killed-by-kill-9-will-subprocess-also-be-killed
        Even Windows sees to have support for something like that: http://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed

        So the trick is to mark the managed process as a daemon process. This makes sense:
        A daemon process is a process that is only there to service other process(es), if none of the processes that it services are alive, it too will be killed by the OS.
        Unfortunately I don't see that the ProcessBuilder API supports a setDaemon method: http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

        Show
        Geoffrey De Smet
        added a comment - On linux (and I am on linux), this should work "You have to make the sub processes daemonic in order to have them killed when the father is killed (or dies), otherwise they are adopted by init(1).": http://stackoverflow.com/questions/1491674/when-a-parent-process-is-killed-by-kill-9-will-subprocess-also-be-killed Even Windows sees to have support for something like that: http://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed So the trick is to mark the managed process as a daemon process. This makes sense: A daemon process is a process that is only there to service other process(es), if none of the processes that it services are alive, it too will be killed by the OS. Unfortunately I don't see that the ProcessBuilder API supports a setDaemon method: http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

          People

          • Assignee:
            Ondrej Zizka
            Reporter:
            Geoffrey De Smet
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: