opencypher / cypher-for-gremlin

Cypher for Gremlin adds Cypher support to any Gremlin graph database.
Apache License 2.0
359 stars 48 forks source link

Tomcat warn about leaked thread-locals #293

Closed mad closed 5 years ago

mad commented 5 years ago

Tomcat check some vars for leaks when undeploy app and warn some info about opencypher

24-Jun-2019 16:53:12.027 SEVERE [https-jsse-nio-8443-exec-10] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [Octopus2] created a ThreadLocal with key of type [org.opencypher.v9_0.util.Rewritable$$anon$1] (value [org.opencypher.v9_0.util.Rewritable$$anon$1@3d748832]) and a value of type [scala.collection.mutable.HashMap] (value [Map(class org.opencypher.v9_0.expressions.And -> public org.opencypher.v9_0.expressions.And org.opencypher.v9_0.expressions.And.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class scala.collection.immutable.$colon$colon -> public scala.collection.immutable.$colon$colon scala.collection.immutable.$colon$colon.copy(java.lang.Object,scala.collection.immutable.List), class org.opencypher.v9_0.expressions.Pattern -> public org.opencypher.v9_0.expressions.Pattern org.opencypher.v9_0.expressions.Pattern.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.SingleQuery -> public org.opencypher.v9_0.ast.SingleQuery org.opencypher.v9_0.ast.SingleQuery.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.RelationshipChain -> public org.opencypher.v9_0.expressions.RelationshipChain org.opencypher.v9_0.expressions.RelationshipChain.copy(org.opencypher.v9_0.expressions.PatternElement,org.opencypher.v9_0.expressions.RelationshipPattern,org.opencypher.v9_0.expressions.NodePattern,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Property -> public org.opencypher.v9_0.expressions.Property org.opencypher.v9_0.expressions.Property.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.PropertyKeyName,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Match -> public org.opencypher.v9_0.ast.Match org.opencypher.v9_0.ast.Match.copy(boolean,org.opencypher.v9_0.expressions.Pattern,scala.collection.Seq,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Where -> public org.opencypher.v9_0.ast.Where org.opencypher.v9_0.ast.Where.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Query -> public org.opencypher.v9_0.ast.Query org.opencypher.v9_0.ast.Query.copy(scala.Option,org.opencypher.v9_0.ast.QueryPart,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Ands -> public org.opencypher.v9_0.expressions.Ands org.opencypher.v9_0.expressions.Ands.copy(scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Not -> public org.opencypher.v9_0.expressions.Not org.opencypher.v9_0.expressions.Not.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.EveryPath -> public org.opencypher.v9_0.expressions.EveryPath org.opencypher.v9_0.expressions.EveryPath.copy(org.opencypher.v9_0.expressions.PatternElement), class scala.Some -> public scala.Some scala.Some.copy(java.lang.Object))]) 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.
25-Jun-2019 12:58:36.291 SEVERE [http-nio-8080-exec-103] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [Octopus2] created a ThreadLocal with key of type [org.opencypher.v9_0.util.Rewritable$$anon$1] (value [org.opencypher.v9_0.util.Rewritable$$anon$1@2e460cff]) and a value of type [scala.collection.mutable.HashMap] (value [Map(class org.opencypher.v9_0.expressions.EveryPath -> public org.opencypher.v9_0.expressions.EveryPath org.opencypher.v9_0.expressions.EveryPath.copy(org.opencypher.v9_0.expressions.PatternElement), class org.opencypher.v9_0.expressions.Ands -> public org.opencypher.v9_0.expressions.Ands org.opencypher.v9_0.expressions.Ands.copy(scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Or -> public org.opencypher.v9_0.expressions.Or org.opencypher.v9_0.expressions.Or.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class scala.Tuple2 -> public scala.Tuple2 scala.Tuple2.copy(java.lang.Object,java.lang.Object), class org.opencypher.v9_0.expressions.Pattern -> public org.opencypher.v9_0.expressions.Pattern org.opencypher.v9_0.expressions.Pattern.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Return -> public org.opencypher.v9_0.ast.Return org.opencypher.v9_0.ast.Return.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.SingleQuery -> public org.opencypher.v9_0.ast.SingleQuery org.opencypher.v9_0.ast.SingleQuery.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.RelationshipChain -> public org.opencypher.v9_0.expressions.RelationshipChain org.opencypher.v9_0.expressions.RelationshipChain.copy(org.opencypher.v9_0.expressions.PatternElement,org.opencypher.v9_0.expressions.RelationshipPattern,org.opencypher.v9_0.expressions.NodePattern,org.opencypher.v9_0.util.InputPosition), class scala.Some -> public scala.Some scala.Some.copy(java.lang.Object), class org.opencypher.v9_0.ast.Match -> public org.opencypher.v9_0.ast.Match org.opencypher.v9_0.ast.Match.copy(boolean,org.opencypher.v9_0.expressions.Pattern,scala.collection.Seq,scala.Option,org.opencypher.v9_0.util.InputPosition), class scala.collection.immutable.$colon$colon -> public scala.collection.immutable.$colon$colon scala.collection.immutable.$colon$colon.copy(java.lang.Object,scala.collection.immutable.List), class org.opencypher.v9_0.ast.ReturnItems -> public org.opencypher.v9_0.ast.ReturnItems org.opencypher.v9_0.ast.ReturnItems.copy(boolean,scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.With -> public org.opencypher.v9_0.ast.With org.opencypher.v9_0.ast.With.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.CaseExpression -> public org.opencypher.v9_0.expressions.CaseExpression org.opencypher.v9_0.expressions.CaseExpression.copy(scala.Option,scala.collection.IndexedSeq,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.FunctionInvocation -> public org.opencypher.v9_0.expressions.FunctionInvocation org.opencypher.v9_0.expressions.FunctionInvocation.copy(org.opencypher.v9_0.expressions.Namespace,org.opencypher.v9_0.expressions.FunctionName,boolean,scala.collection.IndexedSeq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Query -> public org.opencypher.v9_0.ast.Query org.opencypher.v9_0.ast.Query.copy(scala.Option,org.opencypher.v9_0.ast.QueryPart,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.AliasedReturnItem -> public org.opencypher.v9_0.ast.AliasedReturnItem org.opencypher.v9_0.ast.AliasedReturnItem.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.LogicalVariable,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Where -> public org.opencypher.v9_0.ast.Where org.opencypher.v9_0.ast.Where.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Not -> public org.opencypher.v9_0.expressions.Not org.opencypher.v9_0.expressions.Not.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Property -> public org.opencypher.v9_0.expressions.Property org.opencypher.v9_0.expressions.Property.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.PropertyKeyName,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.And -> public org.opencypher.v9_0.expressions.And org.opencypher.v9_0.expressions.And.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition))]) 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.
26-Jun-2019 10:58:46.544 SEVERE [http-nio-8080-exec-16] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [Octopus2] created a ThreadLocal with key of type [org.opencypher.v9_0.util.Rewritable$$anon$1] (value [org.opencypher.v9_0.util.Rewritable$$anon$1@522894e1]) and a value of type [scala.collection.mutable.HashMap] (value [Map(class org.opencypher.v9_0.ast.SingleQuery -> public org.opencypher.v9_0.ast.SingleQuery org.opencypher.v9_0.ast.SingleQuery.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Ands -> public org.opencypher.v9_0.expressions.Ands org.opencypher.v9_0.expressions.Ands.copy(scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.AliasedReturnItem -> public org.opencypher.v9_0.ast.AliasedReturnItem org.opencypher.v9_0.ast.AliasedReturnItem.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.LogicalVariable,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Not -> public org.opencypher.v9_0.expressions.Not org.opencypher.v9_0.expressions.Not.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.EveryPath -> public org.opencypher.v9_0.expressions.EveryPath org.opencypher.v9_0.expressions.EveryPath.copy(org.opencypher.v9_0.expressions.PatternElement), class org.opencypher.v9_0.ast.Where -> public org.opencypher.v9_0.ast.Where org.opencypher.v9_0.ast.Where.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.ReturnItems -> public org.opencypher.v9_0.ast.ReturnItems org.opencypher.v9_0.ast.ReturnItems.copy(boolean,scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class scala.collection.immutable.$colon$colon -> public scala.collection.immutable.$colon$colon scala.collection.immutable.$colon$colon.copy(java.lang.Object,scala.collection.immutable.List), class org.opencypher.v9_0.expressions.CaseExpression -> public org.opencypher.v9_0.expressions.CaseExpression org.opencypher.v9_0.expressions.CaseExpression.copy(scala.Option,scala.collection.IndexedSeq,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Property -> public org.opencypher.v9_0.expressions.Property org.opencypher.v9_0.expressions.Property.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.PropertyKeyName,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.FunctionInvocation -> public org.opencypher.v9_0.expressions.FunctionInvocation org.opencypher.v9_0.expressions.FunctionInvocation.copy(org.opencypher.v9_0.expressions.Namespace,org.opencypher.v9_0.expressions.FunctionName,boolean,scala.collection.IndexedSeq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Pattern -> public org.opencypher.v9_0.expressions.Pattern org.opencypher.v9_0.expressions.Pattern.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Match -> public org.opencypher.v9_0.ast.Match org.opencypher.v9_0.ast.Match.copy(boolean,org.opencypher.v9_0.expressions.Pattern,scala.collection.Seq,scala.Option,org.opencypher.v9_0.util.InputPosition), class scala.Tuple2 -> public scala.Tuple2 scala.Tuple2.copy(java.lang.Object,java.lang.Object), class org.opencypher.v9_0.ast.With -> public org.opencypher.v9_0.ast.With org.opencypher.v9_0.ast.With.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Return -> public org.opencypher.v9_0.ast.Return org.opencypher.v9_0.ast.Return.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.RelationshipChain -> public org.opencypher.v9_0.expressions.RelationshipChain org.opencypher.v9_0.expressions.RelationshipChain.copy(org.opencypher.v9_0.expressions.PatternElement,org.opencypher.v9_0.expressions.RelationshipPattern,org.opencypher.v9_0.expressions.NodePattern,org.opencypher.v9_0.util.InputPosition), class scala.Some -> public scala.Some scala.Some.copy(java.lang.Object), class org.opencypher.v9_0.ast.Query -> public org.opencypher.v9_0.ast.Query org.opencypher.v9_0.ast.Query.copy(scala.Option,org.opencypher.v9_0.ast.QueryPart,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.And -> public org.opencypher.v9_0.expressions.And org.opencypher.v9_0.expressions.And.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition))]) 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.
26-Jun-2019 10:58:46.550 SEVERE [http-nio-8080-exec-16] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [Octopus2] created a ThreadLocal with key of type [org.opencypher.v9_0.util.Rewritable$$anon$1] (value [org.opencypher.v9_0.util.Rewritable$$anon$1@522894e1]) and a value of type [scala.collection.mutable.HashMap] (value [Map(class org.opencypher.v9_0.ast.SingleQuery -> public org.opencypher.v9_0.ast.SingleQuery org.opencypher.v9_0.ast.SingleQuery.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Ands -> public org.opencypher.v9_0.expressions.Ands org.opencypher.v9_0.expressions.Ands.copy(scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.AliasedReturnItem -> public org.opencypher.v9_0.ast.AliasedReturnItem org.opencypher.v9_0.ast.AliasedReturnItem.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.LogicalVariable,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Not -> public org.opencypher.v9_0.expressions.Not org.opencypher.v9_0.expressions.Not.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.EveryPath -> public org.opencypher.v9_0.expressions.EveryPath org.opencypher.v9_0.expressions.EveryPath.copy(org.opencypher.v9_0.expressions.PatternElement), class org.opencypher.v9_0.ast.Where -> public org.opencypher.v9_0.ast.Where org.opencypher.v9_0.ast.Where.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition), class scala.collection.immutable.$colon$colon -> public scala.collection.immutable.$colon$colon scala.collection.immutable.$colon$colon.copy(java.lang.Object,scala.collection.immutable.List), class org.opencypher.v9_0.ast.ReturnItems -> public org.opencypher.v9_0.ast.ReturnItems org.opencypher.v9_0.ast.ReturnItems.copy(boolean,scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.CaseExpression -> public org.opencypher.v9_0.expressions.CaseExpression org.opencypher.v9_0.expressions.CaseExpression.copy(scala.Option,scala.collection.IndexedSeq,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Property -> public org.opencypher.v9_0.expressions.Property org.opencypher.v9_0.expressions.Property.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.PropertyKeyName,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.FunctionInvocation -> public org.opencypher.v9_0.expressions.FunctionInvocation org.opencypher.v9_0.expressions.FunctionInvocation.copy(org.opencypher.v9_0.expressions.Namespace,org.opencypher.v9_0.expressions.FunctionName,boolean,scala.collection.IndexedSeq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.Pattern -> public org.opencypher.v9_0.expressions.Pattern org.opencypher.v9_0.expressions.Pattern.copy(scala.collection.Seq,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Match -> public org.opencypher.v9_0.ast.Match org.opencypher.v9_0.ast.Match.copy(boolean,org.opencypher.v9_0.expressions.Pattern,scala.collection.Seq,scala.Option,org.opencypher.v9_0.util.InputPosition), class scala.Tuple2 -> public scala.Tuple2 scala.Tuple2.copy(java.lang.Object,java.lang.Object), class org.opencypher.v9_0.ast.With -> public org.opencypher.v9_0.ast.With org.opencypher.v9_0.ast.With.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.Option,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.ast.Return -> public org.opencypher.v9_0.ast.Return org.opencypher.v9_0.ast.Return.copy(boolean,org.opencypher.v9_0.ast.ReturnItemsDef,scala.Option,scala.Option,scala.Option,scala.collection.immutable.Set,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.RelationshipChain -> public org.opencypher.v9_0.expressions.RelationshipChain org.opencypher.v9_0.expressions.RelationshipChain.copy(org.opencypher.v9_0.expressions.PatternElement,org.opencypher.v9_0.expressions.RelationshipPattern,org.opencypher.v9_0.expressions.NodePattern,org.opencypher.v9_0.util.InputPosition), class scala.Some -> public scala.Some scala.Some.copy(java.lang.Object), class org.opencypher.v9_0.ast.Query -> public org.opencypher.v9_0.ast.Query org.opencypher.v9_0.ast.Query.copy(scala.Option,org.opencypher.v9_0.ast.QueryPart,org.opencypher.v9_0.util.InputPosition), class org.opencypher.v9_0.expressions.And -> public org.opencypher.v9_0.expressions.And org.opencypher.v9_0.expressions.And.copy(org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.expressions.Expression,org.opencypher.v9_0.util.InputPosition))]) 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.

Sample of code that works in application

CypherAst ast = CypherAst.parse(rewrittenCypher, normalizedParameters);

        Translator<String, GroovyPredicate> groovyTranslator =
            Translator.builder().gremlinGroovy()
                      .inlineParameters()
                      .enableCypherExtensions()
                      .enableMultipleLabels()
                      .build();

        String asGremlin = ast.buildTranslation(groovyTranslator);

        ReturnNormalizer returnNormalizer = ReturnNormalizer.create(ast.getReturnTypes());
        DefaultGraphTraversal g = new DefaultGraphTraversal(traversal.clone());
        Translator<GraphTraversal, P> translator =
            Translator.builder()
                      .traversal(g)
                      .enableCypherExtensions()
                      .enableMultipleLabels()
                      .build();

        try (Transaction tx = traversal.tx()) {
                final List<Result> collect = translatedTraversal.toStream()
                                                                .map(returnNormalizer::normalize)
                                                                .map(Result::new)
                                                                .collect(toList());
                tx.commit();
            }
dwitry commented 5 years ago

Hello @mad,

source of this warning is in external dependency - openCypher Front End.

Could you please redirect your question there?

mad commented 5 years ago

Sure https://github.com/opencypher/front-end/issues/2

dwitry commented 5 years ago

Closing as this should be improved in openCypher Front End