glassfish
  1. glassfish
  2. GLASSFISH-18955

embedded web container does not shutdown properly

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0_b55
    • Component/s: web_container
    • Labels:
      None

      Description

      During embedded testing I noticed that embedded web container is not shutting down properly. Basically WebContainer.preDestroy() needs to undo everything that happens in WebContainer.postConstruct().

      If you want to experiment, the quickest way to try is to do the following:

      Copy a web app to domain1/autodeploy/

      java -DGlassFish_Interactive=true -jar glassfish.jar

      You will see a prompt after sometime. Type:
      start

      It will start GlassFish and deploy the web app. Now you can access the web app.
      Now type:
      stop
      It will stop GlassFish.
      Then start again.
      You will see an NPE like this:

      [#|2012-07-27T23:35:25.988+0530|WARNING|44.0|javax.enterprise.system.container.web.com.sun.enterprise.web.connector|_ThreadID=10;_ThreadName=main;|Error registering contexts
      java.lang.NullPointerException
      at com.sun.enterprise.web.connector.MapperListener.init(MapperListener.java:193)
      at com.sun.enterprise.web.connector.coyote.PECoyoteConnector.start(PECoyoteConnector.java:549)
      at org.apache.catalina.startup.Embedded.start(Embedded.java:932)
      at com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:604)
      at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:132)
      at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:117)
      at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:84)
      at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
      at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:141)
      at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:135)
      at org.glassfish.internal.data.EngineInfo.getContainer(EngineInfo.java:93)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:997)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:707)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:372)
      at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:393)
      at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:229)
      at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:132)
      at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:117)
      at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:84)
      at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
      at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:141)
      at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:135)
      at com.sun.enterprise.v3.server.StartupRunLevelBridge.activate(StartupRunLevelBridge.java:93)
      at com.sun.enterprise.v3.server.RunLevelBridge.postConstruct(RunLevelBridge.java:110)
      at com.sun.enterprise.v3.server.StartupRunLevelBridge.postConstruct(StartupRunLevelBridge.java:65)
      at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:132)
      at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:117)
      at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:84)
      at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
      at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:141)
      at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:141)
      at com.sun.hk2.component.RunLevelInhabitant.get(RunLevelInhabitant.java:110)
      at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:135)
      at com.sun.enterprise.v3.server.AppServerStartup$StartupInhabitantActivator.activate(AppServerStartup.java:526)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService$Worker.activateRunLevel(DefaultRunLevelService.java:1106)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService$Worker.upActiveRecorder(DefaultRunLevelService.java:1060)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService$Worker.run(DefaultRunLevelService.java:1026)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService$SyncProceedToOp.proceedTo(DefaultRunLevelService.java:1256)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService.proceedTo(DefaultRunLevelService.java:797)
      at org.jvnet.hk2.component.internal.runlevel.DefaultRunLevelService.proceedTo(DefaultRunLevelService.java:759)
      at com.sun.enterprise.v3.server.AppServerStartup.proceedTo(AppServerStartup.java:360)
      at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:254)
      at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:172)
      at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:163)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
      at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl.start(EmbeddedOSGiGlassFishImpl.java:73)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
      at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:71)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.startConsole(GlassFishMain.java:129)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:115)
      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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
      at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)

      #]

      Please treat this urgently.

        Activity

        Hide
        jwells added a comment -

        I have recently added the ability for @Singleton scoped objects to be shutdown on the shutdown of the ServiceLocator. I believe that this must therefore be happening because the shutdown of the embedded server isn't happening properly, which is is Mason's area of expertise.

        Show
        jwells added a comment - I have recently added the ability for @Singleton scoped objects to be shutdown on the shutdown of the ServiceLocator. I believe that this must therefore be happening because the shutdown of the embedded server isn't happening properly, which is is Mason's area of expertise.
        Hide
        mtaube added a comment -

        After Revision 55766, WebContainer.preDestroy is being called on shutdown

        Show
        mtaube added a comment - After Revision 55766, WebContainer.preDestroy is being called on shutdown
        Hide
        Amy Roh added a comment -

        I confirm that WebContainer.preDestroy gets invoked on shutdown as expected.

        However, when restarting GrizzlyService.postConstruct is never called and the mappers are not starting.

        GrizzlyService.postConstruct is called as expected when starting glassfish for the first time. Stopping is calling GrizzlyService.preDestroy as expected but restarting glassfish never invokes GrizzlyService.postConstruct.

        Show
        Amy Roh added a comment - I confirm that WebContainer.preDestroy gets invoked on shutdown as expected. However, when restarting GrizzlyService.postConstruct is never called and the mappers are not starting. GrizzlyService.postConstruct is called as expected when starting glassfish for the first time. Stopping is calling GrizzlyService.preDestroy as expected but restarting glassfish never invokes GrizzlyService.postConstruct.
        Hide
        mtaube added a comment -

        After revision 55791, GrizzlyService.preDestroy/postConstruct will be called.

        Show
        mtaube added a comment - After revision 55791, GrizzlyService.preDestroy/postConstruct will be called.
        Hide
        Amy Roh added a comment -

        After Ryan's fix (svn 56001) in GlassfishNetworkListener.stop, restart is working as expected.

        Show
        Amy Roh added a comment - After Ryan's fix (svn 56001) in GlassfishNetworkListener.stop, restart is working as expected.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: