shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Memory leak with ParameterMarkerExpressionSegment

Open HeroHong opened this issue 5 years ago • 3 comments

Bug Report

num #instances #bytes class name

1: 723701 1723060848 [C 2: 23438021 562512504 java.util.LinkedList$Node 3: 22989567 551749608 org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment 4: 19796 24885584 [B 5: 720560 17293440 java.lang.String 6: 348547 11153504 org.apache.shardingsphere.sql.parser.sql.segment.dml.column.ColumnSegment 7: 284008 9088256 java.util.LinkedList 8: 374714 8993136 org.apache.shardingsphere.sql.parser.sql.value.identifier.IdentifierValue 9: 95366 8392208 java.lang.reflect.Method 10: 113274 7787336 [Ljava.lang.Object; 11: 246617 5918808 org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ColumnProjectionSegment 12: 170195 5446240 java.util.concurrent.ConcurrentHashMap$Node 13: 105644 4225760 java.util.LinkedHashMap$Entry 14: 34045 3716200 java.lang.Class 15: 110722 3543104 java.util.HashMap$Node 16: 35275 3271760 [Ljava.util.HashMap$Node; 17: 20645 3092088 [I 18: 89022 2848704 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.PredicateSegment 19: 51995 2495760 org.aspectj.weaver.reflect.ShadowMatchImpl 20: 64925 2077600 org.antlr.v4.runtime.atn.ATNConfig 21: 84638 2031312 java.util.ArrayList 22: 3380 1859456 [Ljava.util.concurrent.ConcurrentHashMap$Node; 23: 51995 1663840 org.aspectj.weaver.patterns.ExposedState 24: 69247 1661928 org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.InsertValuesSegment 25: 29387 1645672 java.util.LinkedHashMap 26: 71822 1538608 [Ljava.lang.Class; 27: 31810 1526880 java.util.HashMap 28: 53692 1417528 [Z 29: 16298 1303840 java.lang.reflect.Constructor 30: 26018 1248864 com.google.common.cache.LocalCache$StrongAccessEntry 31: 25998 1247904 com.google.common.cache.LocalCache$SoftValueReference 32: 51996 1247896 [Lorg.aspectj.weaver.ast.Var; 33: 48475 1163400 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.value.PredicateCompareRightValue 34: 23523 1129104 org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement 35: 27653 1106120 com.sun.org.apache.xerces.internal.dom.DeferredAttrImpl 36: 33396 1068672 com.alibaba.metrics.LongAdder 37: 63699 1019184 java.lang.Object 38: 40309 967416 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.value.PredicateBracketValue 39: 40309 967416 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.value.PredicateInRightValue 40: 40309 967416 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.value.PredicateLeftBracketValue 41: 40309 967416 org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.value.PredicateRightBracketValue 42: 23212 928480 com.sun.org.apache.xerces.internal.dom.DeferredTextImpl

Which version of ShardingSphere did you use?

org.apache.shardingsphere sharding-jdbc-spring-boot-starter 4.1.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

Expected behavior

Actual behavior

Reason analyze (If you can)

SQLParseResultCache GC不了,即使我手动调用System.gc()。cache中的软引用依然存在 wecom-temp-130d4c4bea4878d4babcbd4400a15f4b

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

HeroHong avatar Sep 10 '21 03:09 HeroHong

Hello, for English only. Please translate the title and content, thank you.

RaigorJiang avatar Sep 10 '21 06:09 RaigorJiang

@HeroHong Thanks for your feedback. Could you check this issue on our master branch? Does this issue still exist there?

tristaZero avatar Sep 12 '21 09:09 tristaZero

Duplicate with https://github.com/apache/shardingsphere/issues/12447.

RaigorJiang avatar Sep 28 '21 07:09 RaigorJiang