You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Denis Chudov (Jira)" <ji...@apache.org> on 2023/04/10 12:49:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17710128#comment-17710128 ] 

Denis Chudov commented on IGNITE-15962:
---------------------------------------

The reproducer is too strict and fails even without the listener configurated.

But the truth is that the ContinuousEntry is created for the events that are not configured, However the old value is not passed to this entry (and we see it on the screenshots, that's because of isOldValueRequired == false). Also, the event filter is used only to notify the exact configured event, everything else happens by the same flow (including creation of ContinuousEntry).

> 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: 48h
>  Remaining Estimate: 48h
>
> {{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.10#820010)