0

Tomcat (Apache Tomcat/6.0.18) にメモリ リークがあるようです。

予備分析

ある時点で、いくつかのサーバーのヒープ使用率が 90% を超えました。次に、2 つのリークの可能性を指摘するヒープ ダンプとその分析を行いました。

"" によってロードされた "char[]" の 4 550 インスタンスは、321 358 144 (42,39%) バイトを占有します。

最大のインスタンス:

char [5102000] @ 0xd18668c8 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u0000 \ u00000000000000000000000000000000000000 \ U000000 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000 2...0 1,35%) バイト。


「org.apache.catalina.loader.StandardClassLoader @ 0xbb003c30」によってロードされた「org.apache.tomcat.util.threads.ThreadWithAttributes」の 392 インスタンスは、151 940 704 (20,04%) バイトを占有します。

char[5102000] は何度も繰り返され、null で埋められます。

分析

org.apache.tomcat.util.threads.ThreadWithAttributes

ドミネーター ツリー分析は、主な原因が CA Wily Introscope であることを示しています。

╔═══════════════════════════════════════════════════════════════════════════════════════╦════════════════════════╦═════════════════╦═════════════════╦═════════════╗
║   Class Name                                                                          ║        Objects         ║  Shallow Heap   ║  Retained Heap  ║  Percentage ║
╠═══════════════════════════════════════════════════════════════════════════════════════╬════════════════════════╬═════════════════╬═════════════════╬═════════════╣
║ org.apache.tomcat.util.threads.ThreadWithAttributes                                   ║ 392                    ║        53 312   ║    151 940 704  ║ 20,04%      ║
║ #-java.lang.ThreadLocal$ThreadLocalMap$Entry                                          ║  254 047               ║     8 129 504   ║    146 384 296  ║ 19,31%      ║
║ ##- com.wily.util.adt.CanonicalObjectPoolWithKey                                      ║ 391                    ║        12 512   ║     72 506 184  ║ 9,56%       ║
║ ##- java.util.HashMap                                                                 ║  199 734               ║     7 989 360   ║     40 377 784  ║ 5,33%       ║
║ ###- com.wily.util.adt.WeakWeakIdentityHashMap                                        ║ 391                    ║         9 384   ║     11 503 344  ║ 1,52%       ║
║ #java.util.HashMap$Entry                                                              ║  207 683 #  4 984 392  ║     16 396 456  ║ 2,16%           ║             ║
║ ####- com.wily.introscope.agent.trace.BlamePointTracer$DataAccumulatorGroup           ║   49 807               ║     1 593 824   ║      1 593 824  ║ 0,21%       ║
║ ####- com.wily.introscope.agent.trace.servlet.ServletObjectFactory$MethodKey          ║    2 563               ║        61 512   ║         62 840  ║ 0,01%       ║
║ #####- com.wily.introscope.stat.gatherer.IntegerAverageGatherer                       ║ 92                     ║         5 152   ║         10 304  ║ 0,00%       ║
║ #####- com.wily.introscope.stat.gatherer.IntervalCounterGatherer                      ║ 109                    ║         4 360   ║          4 360  ║ 0,00%       ║
║ #####- com.wily.introscope.stat.gatherer.IntegerFluctuatingCounterGatherer            ║ 55                     ║         3 080   ║          3 080  ║ 0,00%       ║
║ #####- com.wily.introscope.stat.gatherer.IntegerAggregatingFluctuatingCounterGatherer ║ 54                     ║         3 024   ║          3 024  ║ 0,00%       ║
╚═══════════════════════════════════════════════════════════════════════════════════════╩════════════════════════╩═════════════════╩═════════════════╩═════════════╝

文字[]

ドミネーター ツリー分析では何も表示されません。蓄積の唯一のポイントは char[] です。分析「GC ルートへの最短パスのマージ」は、org.apache.tomcat.util.threads.ThreadWithAttributes を直接指しています。

╔══════════════════════════════════════════════════════════════════════════════════════════╦════════════════╦════════════════╦═════════════════════╦════════════════╗
║                                        Class Name                                        ║  Ref. Objects  ║  Shallow Heap  ║  Ref. Shallow Heap  ║  Retained Heap ║
╠══════════════════════════════════════════════════════════════════════════════════════════╬════════════════╬════════════════╬═════════════════════╬════════════════╣
║ org.apache.tomcat.util.threads.ThreadWithAttributes @ 0xd0b12cb8  TP-Processor203 Thread ║              1 ║ 136            ║         10 204 016  ║        240 216 ║
║ - <Java Local> char[5102000] @ 0xd18668c8  \u0000\u0000...                               ║              1 ║    10 204 016  ║         10 204 016  ║     10 204 016 ║
╚══════════════════════════════════════════════════════════════════════════════════════════╩════════════════╩════════════════╩═════════════════════╩════════════════╝

質問

nullで満たされた多くのオブジェクトchar []を作成する責任は何ですか? ヒープで多くのスペースを占有しない問題を解決するにはどうすればよいですか?.

4

2 に答える 2

1

JspWriterImpl プールを無効にしてみてください。JRE 起動コマンドに次のパラメータを追加してください。

-Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true

これにより、使用後に JspWriterImpl バッファが解放されます

于 2015-06-04T08:34:21.233 に答える
-1

提示された情報が少ないため、問題がどこにあるのかを判断するのは困難です。さらに、TomCat は安定しておらず、バグがないこともよく知られているため、リークは TomCat 自体にもある可能性があります。

問題を手動で見つけることができない場合は、FindBugs (無料のオープン ソース) などの静的コード分析ツールを使用してコードをスキャンできます。

于 2013-10-18T12:00:55.463 に答える