lichenglin created PHOENIX-2860:
-----------------------------------

             Summary: The phoenix driver may cause memory leak when redeploy By 
tomcat
                 Key: PHOENIX-2860
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2860
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.6.0
         Environment: tomcat7
            Reporter: lichenglin


I'm using  org.apache.commons.dbcp.BasicDataSource to query the server.
here is my code in spring.xml

{code:xml}
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
                destroy-method="close">
                <property name="driverClassName" 
value="org.apache.phoenix.jdbc.PhoenixDriver" />
                <property name="url" value="jdbc:phoenix:master" />
                <property name="username" value="" />
                <property name="password" value="" />
        </bean>
{code}

But when I used jenkins to redeploy the war ,I got this message in the tomcat's 
log 

{code}
27-Apr-2016 15:55:21.579 WARNING [http-nio-9080-exec-36] 
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web 
application [console] appears to have started a thread named [Timer for 
'phoenix' metrics system] but has failed to stop it. This is very likely to 
create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.util.TimerThread.mainLoop(Timer.java:552)
 java.util.TimerThread.run(Timer.java:505)
{code}

I'm trying to close the driver when the servlet shutdown with the code 
{code}
        @EventListener({ ContextStoppedEvent.class, ContextClosedEvent.class })
        public void handleContextStart(ApplicationContextEvent e)
                        throws SchedulerException, InterruptedException, 
SQLException, IOException {
                if (deploy) {
                        System.out.println("###################");
                        source.close();
                        PhoenixDriver.INSTANCE.close();
                }
        }
{code}
It doesn't work!!





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to