You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Kukushkin (Jira)" <ji...@apache.org> on 2022/05/12 07:23:00 UTC

[jira] [Updated] (IGNITE-15962) CacheEntryRemovedListener makes the PUT operation to create ENTRY CREATED events

     [ https://issues.apache.org/jira/browse/IGNITE-15962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Kukushkin updated IGNITE-15962:
--------------------------------------
    Remaining Estimate: 72h
     Original Estimate: 72h

> CacheEntryRemovedListener makes the PUT operation to create ENTRY CREATED events
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-15962
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15962
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 2.11
>            Reporter: Alexey Kukushkin
>            Priority: Major
>              Labels: cggg
>         Attachments: CacheContinuousQueryEntry-HeapDump.png, CacheContinuousQueryEntry-StackTrace.png, EventListenerHeapUsage.java, IgniteServer.java, build.gradle
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> {{CacheEntryRemovedListener}} configured with {{MutableCacheEntryListenerConfiguration.isOldValueRequired = false}} makes the {{Cache#put}} operation to create {{CREATED}} events on the primary server for a short period of time. This is inefficient when working with large objects: our application running with limited heap memory fails with {{java.lang.OutOfMemoryError: Java heap space}} after executing a {{PUT}} operation since the entry referencing the object is "stuck" on the heap.
> h2. Reproducer
> h3. Steps
> We need two Ignite server nodes to demonstrate the problem. A cache is deployed on both the nodes and both the nodes listen to the {{ENTRY REMOVED}} events. Both the nodes disable fetching the {{CacheEntryEvent#getOldValue}} by setting {{MutableCacheEntryListenerConfiguration.isOldValueRequired = false}}
>  # Build and run the attached [^IgniteServer.java]. This server is configured like described above and runs until manually terminated.
>  # Build the run the attached test [^EventListenerHeapUsage.java] . This test:
>  ## Starts another server configured like described above
>  ## Puts a large object taking 35% of the free memory. This is done in an isolated scope so the memory after the operation is garbage collected,
>  ## Attempts to allocate 70% of the heap.
> h3. Expected
> The last "allocate 70% of the heap" operation should succeed.
> h3. Actual
> {noformat}
> Caused by: java.lang.OutOfMemoryError: Java heap space
> 	at apache.ignite.issues.EventListenerHeapUsage.entryRemovedEventListenerFetchesValueOnHeap(EventListenerHeapUsage.java:33)
> {noformat}
> h2 Analysis
> For some reason configuring the event listener makes the {{IgniteCache#put}} operation to create and attach an instance of {{CacheContinuousQueryEntry}} with {{evtType=CREATED}} and {{newObject}} referencing the entry.
> The attached heap dump  !CacheContinuousQueryEntry-HeapDump.png! collected on the {{OutOfMemoryError}} demonstrates the large object "stuck" on the heap.
> The attached {{CacheContinuousQueryEntry}} initialization  !CacheContinuousQueryEntry-StackTrace.png! proves the {{ENTRY CREATED}} event is being created even though we did not configure it.
> It seems wrong that Ignite needs to attached the {{ENTRY CREATED}} event to the "update" message. Please enhance Ignite to not be doing that or explain why Ignite must do that.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)