glassfish
  1. glassfish
  2. GLASSFISH-19126

AssertionError while executing asadmin osgi command

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_dev
    • Fix Version/s: 4.0_dev
    • Component/s: OSGi
    • Labels:
      None

      Description

      Start the server with assertion enabled. e.g, you can do this:

      java -ea -jar glassfish/modules/glassfish.jar

      Now run:
      asadmin osgi
      You will see
      remote failure: java.lang.AssertionError
      Command osgi failed.

      Server.log contains the following exception:

      [#|2012-10-05T13:31:53.445+0530|SEVERE|44.0|javax.enterprise.system.tools.admin.com.sun.enterprise.v3.admin|_ThreadID=12;_ThreadName=admin-listener(1);_TimeMillis=1349424113445;_LevelValue=1000;|Exception in command execution : java.lang.AssertionError
      java.lang.AssertionError
      at org.apache.felix.gogo.runtime.threadio.ThreadIOImpl.setStreams(ThreadIOImpl.java:100)
      at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:104)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
      at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
      at org.glassfish.osgi.cli.remote.OSGiShellCommand.execute(OSGiShellCommand.java:257)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:549)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:570)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1450)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:118)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1760)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1710)
      at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:469)
      at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:251)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.glassfish.jersey.server.model.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:80)
      at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:107)
      at org.glassfish.jersey.server.model.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:146)
      at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:80)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:304)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:299)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:90)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:198)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:174)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:747)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:306)
      at org.glassfish.admin.rest.adapter.RestAdapter$1.service(RestAdapter.java:327)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189)
      at com.sun.enterprise.v3.server.HK2Dispatcher.dispatch(HK2Dispatcher.java:113)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:236)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:825)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:578)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:558)
      at java.lang.Thread.run(Thread.java:662)

      #]

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        I have put in a fix like this in svn rev #56275. I think we need similar fix in some other place as well. I have to wait for Ancoron to confirm. So, I am not resolving the bug yet although I have committed the following fix which fixes the issue I was encountering.
        diff --git a/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java b/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/
        index b062144..e148ad7 100644
        — a/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java
        +++ b/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java
        @@ -253,7 +253,7 @@ public class OSGiShellCommand implements AdminCommand, PostConstruct {
        if("asadmin-osgi-shell".equals(cmdName))

        { out.println("gogo"); }

        else

        { - CommandSession session = cp.createSession(null, out, err); + CommandSession session = cp.createSession(System.in, out, err); session.execute(cmd); session.close(); }
        Show
        Sanjeeb Sahoo added a comment - I have put in a fix like this in svn rev #56275. I think we need similar fix in some other place as well. I have to wait for Ancoron to confirm. So, I am not resolving the bug yet although I have committed the following fix which fixes the issue I was encountering. diff --git a/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java b/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/ index b062144..e148ad7 100644 — a/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java +++ b/nucleus/osgi-platforms/osgi-cli-remote/src/main/java/org/glassfish/osgi/cli/remote/OSGiShellCommand.java @@ -253,7 +253,7 @@ public class OSGiShellCommand implements AdminCommand, PostConstruct { if("asadmin-osgi-shell".equals(cmdName)) { out.println("gogo"); } else { - CommandSession session = cp.createSession(null, out, err); + CommandSession session = cp.createSession(System.in, out, err); session.execute(cmd); session.close(); }
        Hide
        ancoron added a comment -

        I think, System.in could break real interactive commands as it could block forever. I currently don't know any of the official ones, but users might have already implemented some.

        Therefore, I'd rather go with a slightly different approach by using a "fake" InputStream which always says that it doesn't have data and doesn't block (attached patch GLASSFISH-19126.patch).

        In case the System.in is already being handled properly in a different way inside the GlassFish runtime this patch is not required.

        Show
        ancoron added a comment - I think, System.in could break real interactive commands as it could block forever. I currently don't know any of the official ones, but users might have already implemented some. Therefore, I'd rather go with a slightly different approach by using a "fake" InputStream which always says that it doesn't have data and doesn't block (attached patch GLASSFISH-19126.patch ). In case the System.in is already being handled properly in a different way inside the GlassFish runtime this patch is not required.
        Hide
        Sanjeeb Sahoo added a comment -

        Integrated patch from Ancoron in svn rev #56296.

        Show
        Sanjeeb Sahoo added a comment - Integrated patch from Ancoron in svn rev #56296.

          People

          • Assignee:
            Sanjeeb Sahoo
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: