Orientdb: When I close tomcat, it throws several errors related to OrientDB. This issue is I believe similar to this one, #2508

Created on 28 Aug 2014  路  5Comments  路  Source: orientechnologies/orientdb

I am using Spring 4.0.5 for dependency injection. I have defined OrientDB as a bean in the root application context which shares it with everything. I have even specified the shutdown() method to terminate the bean safely. I am using 1.7.8 version and an older version of blueprints (2.5.0-SNAPSHOT) which was working. I have noticed that the 2.4.0 version of blueprints-orient-graph has an issue too. This works and I am able to fetch data too, but while closing the server it is giving some errors.

   <bean id="orientConnector"
    class="com.tinkerpop.blueprints.impls.orient.OrientGraph" destroy-method="shutdown">

    <constructor-arg type="String">
        <value>remote:localhost/database/#####</value>
    </constructor-arg>
    <constructor-arg type="String">
        <value>admin</value>
    </constructor-arg>
    <constructor-arg type="String">
        <value>admin</value>
    </constructor-arg>
</bean>

The problem comes when I shutdown the server manually and I can see a bunch of errors mostly related to some threads that cannot be closed by Tomcat. Will this cause any troubles later?

INFO: Closing Spring root WebApplicationContext
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Closing Root WebApplicationContext: startup date [Thu Aug 28 15:39:25 IST 2014]; root of context hierarchy
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/PredictorWebService] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/PredictorWebService] appears to have started a thread named [OrientDB MemoryWatchDog] but has failed to stop it. This is very likely to create a memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/PredictorWebService] appears to have started a thread named [OrientDB <- Asynch Client (/127.0.0.1:2424)] but has failed to stop it. This is very likely to create a memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal and a value of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal.OStorageRemoteSession but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal and a value of type com.orientechnologies.orient.core.db.record.ODatabaseRecordTx but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type com.tinkerpop.blueprints.impls.orient.OrientGraphContext but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal and a value of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal.OStorageRemoteSession but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal and a value of type com.orientechnologies.orient.core.db.record.ODatabaseRecordTx but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type com.tinkerpop.blueprints.impls.orient.OrientGraphContext but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/PredictorWebService] created a ThreadLocal with key of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal and a value of type com.orientechnologies.orient.client.remote.OStorageRemoteThreadLocal.OStorageRemoteSession but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 28, 2014 3:39:52 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8443"]

wontfix

Most helpful comment

I saw something like this. The problem was in "Shutdown hook" that is set in Orient. Solution is following: remove default hook

Orient.instance().removeShutdownHook();

and shutdown DB explicitly from "onShutdown" methods of your application

Orient.instance().shutdown();

That will make process of shutdown more synchronous and predictable.

All 5 comments

Interesting, thank you. I suppose we will fix it in 1.7.9.

I saw something like this. The problem was in "Shutdown hook" that is set in Orient. Solution is following: remove default hook

Orient.instance().removeShutdownHook();

and shutdown DB explicitly from "onShutdown" methods of your application

Orient.instance().shutdown();

That will make process of shutdown more synchronous and predictable.

Hi laa, thank you for considering it.

Hi PhantomYdn, actually I am using the blueprints interface to connect to the Database so that I can create a generic implementation and this is one primary requirement. This happens when the blueprints client calls the shutdown method which shuts it down just fine in a non threaded environment.

Hi laa, I made a mistake, the problem was with my older API, I was using an older one due to this not updated document on blueprints site https://github.com/orientechnologies/orientdb/wiki/Graph-Database-Tinkerpop. I saw some posts and your comments on using the graphdb and the errors are gone. Sorry for the trouble!!!

Is there a blueprints method to call Orient.Instance.shutdown()? I too am trying to keep my implementation graph-database agnostic.

Was this page helpful?
0 / 5 - 0 ratings