You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2016/12/27 01:49:58 UTC

[jira] [Comment Edited] (LUCENE-7595) RAMUsageTester in test-framework and static field checker no longer works with Java 9

    [ https://issues.apache.org/jira/browse/LUCENE-7595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15779360#comment-15779360 ] 

Uwe Schindler edited comment on LUCENE-7595 at 12/27/16 1:49 AM:
-----------------------------------------------------------------

Here is my patch that makes test works on whole Lucene:
- On Java 9 it disables the static leak detector
- RamUsageTester was fixed to have some "shortcuts" which are used  if Java 9+ is detected: String/StringBuffer/StringBuilder and some other types are calculated using their length/capacity. It also estimates memory usage of Maps and Iterables by just iterating over their items (not respecting the Hash/LinkedHash impl details, just plain stupid summing up). Because of this I had to disable one test for the LRU cache, but otherwise the estimation is almost correct. All other uses of RamUsageTester pass :-)

[~dweiss]: What do you think?


was (Author: thetaphi):
Here is my patch that makes test works on whole Lucene:
- On Java 9 it disables the static leak detector
- RamUsageTester was fixed to have some "shortcuts" which are used  if Java 9+ is detected: String/StringBuffer/StringBuilder and some other types are calculated using their length/capacity. It also estimates memory usage of Maps and Iterables by just iterating over their items (not respecting the Hash/LinkedHash impl details, just plain stupid summing up). Because of this I had to disable one test for the LRU cache, but otherwise the estimation is almost correct. All other uses of RamUsageTester pass :-)

[~dweiss], [~dawid.weiss], [~dawidweiss]: What do you think?

> RAMUsageTester in test-framework and static field checker no longer works with Java 9
> -------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7595
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7595
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: general/test
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>              Labels: Java9
>         Attachments: LUCENE-7595.patch
>
>
> Lucene/Solr tests have a special rule that records memory usage in static fields before and after test, so we can detect memory leaks. This check dives into JDK classes (like java.lang.String to detect their size). As Java 9 build 148 completely forbids setAccessible on any runtime class, we have to change or disable this check:
> - As first step I will only add the rule to LTC, if we not have Java 8
> - As a second step we might investigate how to improve this
> [~rcmuir] had some ideas for the 2nd point:
> - Don't dive into classes from JDK modules and instead "estimate" the size for some special cases (like Strings)
> - Disallow any static field in tests that is not final (constant) and points to an Object except: Strings and native (wrapper) types.
> In addition we also have RAMUsageTester, that has similar problems and is used to compare estimations of Lucene's calculations of Codec/IndexWriter/IndexReader memory usage with reality. We should simply disable those tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org