dev@glassfish.java.net

Re: Timeout when stop the domain with --force=false after deployed the ejb application

From: ??? <lvsongping_at_gmail.com>
Date: Fri, 3 May 2013 21:51:38 +0800

Hi, Hong:
     I found some differences about the logical between --force=true and
--force=false as follows:

StopServer.doExecute

    protected final void doExecute(ServiceLocator habitat,
ServerEnvironment env, Logger logger, boolean force) {

        try {

            logger.info(localStrings.getLocalString("stop.domain.init", "Server
shutdown initiated"));

            // Don't shutdown GlassFishRuntime, as that can bring the OSGi
framework down which is wrong

            // when we are embedded inside an existing runtime. So, just
stop the glassfish instance that

            // we are supposed to stop. Leave any cleanup to some other
code.


            // get the GlassFish object - we have to wait in case startup
is still in progress

            // This is a temporary work-around until HK2 supports waiting
for the service to

            // show up in the ServiceLocator.

            GlassFish gfKernel = habitat.getService(GlassFish.class);

            while (gfKernel == null) {

                Thread.sleep(1000);

                gfKernel = habitat.getService(GlassFish.class);

            }

            // gfKernel is absolutely positively for-sure not null.

            gfKernel.stop();

        }

        catch (Throwable t) {

            // ignore

        }



        if(force)

            System.exit(0);

        else

            deletePidFile(env);

    }


after we type as --force=true option, it will execute the
the System.exit(0); and the server or cluster will stop as expected.


Thanks


Jeremy




2013/5/3 Hong Zhang <hong.hz.zhang_at_oracle.com>

> Hi, Jeremy
> I could see the stop-domain command also hang for me when I used the
> option force=false. The stop-domain command executed successfully when I
> did not specify the force option.
>
> Tom: what's the difference between when --force option is false versus
> true? When could user specify the option value as false? Should they just
> always stick with the default "true" value?
>
> Thanks,
>
> - Hong
>
>
> On 5/3/2013 2:41 AM, lvsongping wrote:
>
> Hi, Hong, Marina:****
>
> Cc: Tom, dev:****
>
> ** **
>
> I have found a strange situation that it will be timeout if I stop the
> DAS or instance with –force=false after I have deployed an ejb application.
> Here’s my reproduced steps:****
>
> ** **
>
> 1). asadmin start-domain****
>
> ** **
>
> 2). asadmin deploy Hello.jar****
>
> Application deployed with name Hello.****
>
> Command deploy executed successfully.****
>
> ** **
>
> 3). asadmin stop-domain –force=false****
>
> Waiting for the domain to stop .......................................****
>
> Timed out (60 seconds) waiting for the domain to stop.****
>
> Command stop-domain failed.****
>
> ** **
>
> 4).jstack jvm_pid > jstack.txt(I have attached the jstack file).****
>
> ** **
>
> 5). asadmin start-domain****
>
> Waiting for domain1 to start .Error starting domain domain1.****
>
> The server exited prematurely with exit code 1.****
>
> Before it died, it produced the following output:****
>
> ** **
>
> FATAL ERROR in native method: JDWP No transports initialized,
> jvmtiError=AGENT_E****
>
> RROR_TRANSPORT_INIT(197)****
>
> ERROR: transport error 202: bind failed: Address already in use****
>
> ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)*
> ***
>
> JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized
> [../.****
>
> ./../src/share/back/debugInit.c:750]****
>
> ** **
>
> Command start-domain failed.****
>
> ** **
>
> Then the domain can’t be start normally, I think somewhere must lock the
> file because of deploy the ejb application. But I don’t the exactly reason
> about this.****
>
> ** **
>
> BTW: <1>. The exception will not come out if we stop the domain or cluster
> with default option of –force.****
>
> <2>. The exception will not come out if stop the DAS and cluster after
> only deployed the web application.****
>
> ** **
>
> ** **
>
> Thanks****
>
> ** **
>
> -Jeremy****
>
> ** **
>
>
>