[
https://issues.apache.org/jira/browse/IGNITE-17734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17954476#comment-17954476
]
Sergey Korotkov commented on IGNITE-17734:
------------------------------------------
It appears that the C2 JIT compiler optimizations cause this incorrect behavior
(exclusively in case of ShenandoahGC and jdk17/jdk21).
In the _PagesList$CutTail.run()_ method, the reading and writing of nextId are
reordered. So _tailId_ is always 0. If asserts are active, then checking
_tailId_ for 0 prevents this reordering. So fix is to add _tailId_ check
irrespectively on asserts presence:
!fix.png|width=800!
The effect is visible in the generated assembler code.
Note that 0x30 (PagesListNodeIO.NEXT_PAGE_ID_OFF) is exactly the offset in the
page where the pointer to the next one in FreeList is stored.
Shenandoah GC and {*}no asserts{*}:
!shenandoah_and_no_asserts.png|width=800!
Shenandoah GC and {*}asserts{*}:
!shenandoah_and_asserts.png|width=800!
In the case G1GC and there are {*}no asserts{*}, the optimization is less
aggressive and no reordering is observed:
!G1_and_no_asserts.png|width=800!
***
Test shows that jdk11 is not affected for any of garbage collectors (G1GC,
ShenandoahGC, ZGC are tested)
jdk17 and jdk21 with ShenandoahGC are affected.
***
Full assembler code for cases above are attached for references. Produced on
the below java version
{noformat}
openjdk version "17.0.15" 2025-04-15
OpenJDK Runtime Environment (build 17.0.15+6-Ubuntu-0ubuntu124.04)
OpenJDK 64-Bit Server VM (build 17.0.15+6-Ubuntu-0ubuntu124.04, mixed mode,
sharing)
{noformat}
> CorruptedFreeListException after upgrade to 2.13.0 and JDK17
> ------------------------------------------------------------
>
> Key: IGNITE-17734
> URL: https://issues.apache.org/jira/browse/IGNITE-17734
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Affects Versions: 2.12, 2.13, 2.14
> Environment: JDK17, IGNITE 2.13.0
> Reporter: Lopata
> Assignee: Sergey Korotkov
> Priority: Major
> Labels: ise
> Fix For: 2.18
>
> Attachments: FreeListTest.java, G1_and_no_asserts.png, fix.png,
> image-2022-12-03-09-31-27-347.png, shenandoah_and_asserts.png,
> shenandoah_and_no_asserts.png, stacktrace.txt
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> After migration to Ignite version 2.13.0 from 2.12.0 we are getting following
> error:
> org.apache.ignite.internal.processors.cache.persistence.freelist.CorruptedFreeListException:
> Failed to insert data row
> caused by:
> Caused by: java.lang.IllegalStateException: Tail not found: 0
>
> Full stack trace is in attachment. Along with the Ignite version upgrade, we
> are updating Java from 11 to 17. There have been no other changes in our code
> or IGNITE configurations. The error occurs after a few hours of running and
> then occurs for every store.
> Can you help us to to solve this problem.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)