Samarth Jain created PHOENIX-4113:
-------------------------------------

             Summary: Killing forked JVM may cause resources to be not released
                 Key: PHOENIX-4113
                 URL: https://issues.apache.org/jira/browse/PHOENIX-4113
             Project: Phoenix
          Issue Type: Bug
            Reporter: Samarth Jain
            Assignee: Samarth Jain


We have a <shutdown>kill</shutdown> configured in pom which behind the scenes 
calls 
{code}
java.lang.Runtime.halt(1)
{code}

We also have a shutdown hook which is calling halt on the JVM.
{code}
private static String checkClusterInitialized(ReadOnlyProps serverProps) throws 
Exception {
        if (!clusterInitialized) {
            url = setUpTestCluster(config, serverProps);
            clusterInitialized = true;
            Runtime.getRuntime().addShutdownHook(new Thread() {
                @Override
                public void run() {
                    logger.info("SHUTDOWN: halting JVM now");
                    Runtime.getRuntime().halt(0);
                }
            });
        }
        return url;
    }
{code}

This causes JVM to not execute all shutdown hooks which in turn would cause the 
JVM process to not release all the system resources (network ports, file 
handles, etc) it was using. If OS is not able to clean up these orphaned 
resources soon enough, it could cause subsequent new JVM processes to run into 
resource issues.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to