RFR: JDK-8306462: Remove NMT gtests that test dead-block-printing
Thomas Stuefe
stuefe at openjdk.org
Fri Apr 21 07:08:57 UTC 2023
On Fri, 21 Apr 2023 05:45:51 GMT, David Holmes <dholmes at openjdk.org> wrote:
>
> The test fails because:
>
> ```
> const bool b = MemTracker::print_containing_region(p, &ss);
> ```
>
> evaluates false when true was expected. But what does that mean? @tsuefe if you can explain what the test expected versus what it found then it may be easier to see why the test is flawed. To me the test seemed fairly straight-forward: create a block, mark it dead, then poke around in it and see if we get what we expected. Thanks.
@dholmes-ora : the test calls "print_containing_region" and expects output like "inside dead block at XXX" or "nearby dead block at XXX". The "nearby" range is very small btw, chosen to give us info for out of range accesses.
The print loop does not find the block.
Since actually *freeing* the block with os::free would make the test shaky (haha) because the libc could reuse the space for a different block before I call print_containing_block, I "faked" a dead block by not calling os::free and instead just changing the NMT malloc header to "dead block".
The print logic goes upward and looks for the nearest containing live block (for the nearest NMT header in memory) or the nearest containing dead block, with a live block having preference.
There must be an error in this loop somewhere. One possibility is that the loop stride is too large, maybe there is a stupid bug somewhere. However, the more I think about this, the less I think this is a test error.
I think now the better way to deal with this is to just disable the test and fix it if I have time, or someone else has.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13539#issuecomment-1517365913
More information about the hotspot-runtime-dev
mailing list