<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Meiryo,'メイリオ',Sans-Serif;">
<p></p>
<div>suga様 水野様<i><br>
<br>
お世話になっております。 石川と申します。</i><br>
</div>
<p>水野様、確認が遅くなりまして申し訳ございません、お心添えいただきありがとうございました。</p>
<p>suga様、大変申し訳ございません、ご対応頂きましたバージョンは公式サイトでリリース頂くことは可能でしょうか。</p>
<p>チームの規定で公式にリリースされたものしか取り扱うことが出来ず、</p>
<p>お手数でございますが、ご検討いただけますと<span class="st"><em>幸甚</em>に存じま</span>す。<br>
</p>
<p></p>
<br>
何卒よろしくお願いいたします。<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>差出人:</b> mayaa-user-bounces@ml.seasar.org <mayaa-user-bounces@ml.seasar.org> が 水野謙 <mizuno.ken@interfactory.co.jp> の代理で送信<br>
<b>送信日時:</b> 2017年1月23日 9:28<br>
<b>宛先:</b> Discussion list for mayaa users<br>
<b>件名:</b> [mayaa-user:1064] Re: ReferenceCacheの不具合報告</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">suga さん、<br>
<br>
水野です。迅速な対応ありがとうございます。<br>
<br>
2017年1月22日 21:19 suga <ko.suga@gmail.com>:<br>
> suga です。<br>
><br>
> この件、下記にて対応しました。<br>
><br>
> <a href="https://github.com/seasarorg/mayaa/issues/3" id="LPlnk843906">https://github.com/seasarorg/mayaa/issues/3</a>
<div id="LPBorder_GT_14896643279820.6220035106648716" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14896643279770.17798474766430328" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="ImageCell_14896643279780.2909416296318419" style="width: 250px; position: relative; display: table-cell; padding-right: 20px;" colspan="1">
<div id="LPImageContainer_14896643279780.2688456545616049" style="background-color: rgb(255, 255, 255); height: 250px; position: relative; margin: auto; display: table; width: 250px;">
<a id="LPImageAnchor_14896643279780.20837018381901928" style="display: table-cell; text-align: center;" href="https://github.com/seasarorg/mayaa/issues/3" target="_blank"><img style="display: inline-block; max-width: 250px; max-height: 250px; height: 250px; width: 250px; border-width: 0px; vertical-align: bottom;" aria-label="リンク付きのプレビュー画像が選択されました。ダブル タップしてリンクを開きます。" id="LPThumbnailImageID_14896643279780.7564971085910358" height="250" width="250" src="https://avatars3.githubusercontent.com/u/1319421?v=3&s=400"></a></div>
</td>
<td id="TextCell_14896643279790.2448660222150959" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_14896643279790.2887422810917569"></div>
<div id="LPTitle_14896643279790.8673408543710701" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "Meiryo UI","MS UI Gothic","MS PGothic","MS Pゴシック","MS Gothic","MS ゴシック",sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14896643279800.757952374985536" style="text-decoration: none;" href="https://github.com/seasarorg/mayaa/issues/3" target="_blank">ReferenceCacheのcontains, removeが動作しない · Issue #3 ...</a></div>
<div id="LPMetadata_14896643279800.30432827611004254" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "Meiryo UI","MS UI Gothic","MS PGothic","MS Pゴシック","MS Gothic","MS ゴシック",sans-serif; font-size: 14px; line-height: 14px;">
github.com</div>
<div id="LPDescription_14896643279810.8269841544692739" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "Meiryo UI","MS UI Gothic","MS PGothic","MS Pゴシック","MS Gothic","MS ゴシック",sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
[mayaa-user:1061] より。 ReferenceCacheのcontains, removeが動作しない。 addする際にReferenceでwrapしているため、比較する際にはそれを ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
><br>
><br>
> 2017年1月17日(火) 9:18 suga <ko.suga@gmail.com>:<br>
>><br>
>> suga です。<br>
>><br>
>> ありがとうございます。<br>
>> 私の方でも確認して修正します。<br>
>><br>
>><br>
>> 2017年1月16日(月) 20:16 水野謙 <mizuno.ken@interfactory.co.jp>:<br>
>>><br>
>>> お世話になっております。<br>
>>> インターファクトリーの水野と申します。私自身がこのMLに投稿するのは初めてですが、<br>
>>> 以前弊社に在籍していた石上さん経由で大変お世話になっておりました。<br>
>>><br>
>>> さて表題の件ですが、NamespaceImpl#getInstance および deserialize に書かれている下記ロジックが<br>
>>> 期待通りに動作していないと思われる不具合を発見しました。<br>
>>> if (_cache.contains(namespace) == false) {<br>
>>> _cache.add(namespace);<br>
>>> }<br>
>>><br>
>>> ReferenceCache#add にて、要素を SoftReference 等でラップしてから追加していますが、<br>
>>> contains メソッドは ArrayList の実装がそのまま使われるため、常に false を返していると思われます。<br>
>>> このため、重複する要素が多数 _cache に追加され、弊社本番環境では起動後半日の運用で<br>
>>> 2万を超える要素数となっておりました。<br>
>>><br>
>>> ArrayList#contains は内部的に indexOf を呼び出しているので、下記のように indexOf を<br>
>>> オーバーライドすることで解消できそうです。<br>
>>> public int indexOf(Object o) {<br>
>>> for (int i = 0; i < size(); i++) {<br>
>>> if (((Reference)get(i)).get().equals(o)) {<br>
>>> return i;<br>
>>> }<br>
>>> }<br>
>>> return -1;<br>
>>> }<br>
>>><br>
>>> なお、こちらは未検証ですが、URLImpl#setValue にある下記ロジックにも類似の問題がありそうです。<br>
>>> if (_value != null) {<br>
>>> _cache.remove(this);<br>
>>> }<br>
>>><br>
>>> 参考までに本不具合に気付いた経緯についてですが、弊社本番環境にてごくまれに、<br>
>>> 性能が突然極端に低下し、CPUリソースが枯渇する現象が発生しておりました。<br>
>>> スレッドダンプを取得したところNamespaceImpl.getInstanceにてモニタ取得待ちで待機している<br>
>>> スレッドが大量にあり、付近のロジックを調査して発見した次第です。<br>
>>> だいぶ前の話ではありますが、[mayaa-user:1027] にて石川様が報告されている現象も<br>
>>> 同一の原因かもしれません。<br>
>>><br>
>>> ご確認の上、修正のご検討をいただけますでしょうか。<br>
>>> なお、弊社環境用には既に修正版を作成済みのため、弊社側の状況としては特に急いではおりません。<br>
>>><br>
>>> よろしくお願いいたします。<br>
>>><br>
>>> --<br>
>>> 株式会社インターファクトリー 水野 謙<br>
>>> mizuno.ken@interfactory.co.jp<br>
>>><br>
>>> 〒102-0071<br>
>>> 東京都千代田区富士見2-10-2 飯田橋グラン・ブルーム4階<br>
>>> TEL:03-5211-0056 / FAX:03-5211-0059<br>
>>> <a href="http://www.interfactory.co.jp">http://www.interfactory.co.jp</a><br>
>>> _______________________________________________<br>
>>> mayaa-user mailing list<br>
>>> mayaa-user@ml.seasar.org<br>
>>> <a href="https://ml.seasar.org/mailman/listinfo/mayaa-user">https://ml.seasar.org/mailman/listinfo/mayaa-user</a><br>
><br>
><br>
> _______________________________________________<br>
> mayaa-user mailing list<br>
> mayaa-user@ml.seasar.org<br>
> <a href="https://ml.seasar.org/mailman/listinfo/mayaa-user">https://ml.seasar.org/mailman/listinfo/mayaa-user</a><br>
<br>
<br>
<br>
-- <br>
株式会社インターファクトリー 水野 謙<br>
mizuno.ken@interfactory.co.jp<br>
<br>
〒102-0071<br>
東京都千代田区富士見2-10-2 飯田橋グラン・ブルーム4階<br>
TEL:03-5211-0056 / FAX:03-5211-0059<br>
<a href="http://www.interfactory.co.jp">http://www.interfactory.co.jp</a><br>
_______________________________________________<br>
mayaa-user mailing list<br>
mayaa-user@ml.seasar.org<br>
<a href="https://ml.seasar.org/mailman/listinfo/mayaa-user">https://ml.seasar.org/mailman/listinfo/mayaa-user</a><br>
</div>
</span></font></div>
</div>
</body>
</html>