Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbac

2020-04-21 03:15发布

问题:

I'm using Ignite.NET 2.7.6 and sometimes it crashes in

Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.CacheEntryFilterApply(long memPtr)

because var t == null and t.Invoke(stream) throws NullPointerException.

What I'm doing wrong to trigger this issue?

Added: stream.ReadLong() in mentioned method returns 0, so the expression

_ignite.HandleRegistry.Get(stream.ReadLong())

gets filter holder with id == 0, that look like invalid id.

Possible solution: I create scan query with a binary filter like this:

    cursor = cache.WithKeepBinary.Query(new ScanQuery(myFilter))

Later I use this cursor in a separate thread to collect the result: get an enumerator from it and iterate through objects.

But I had the logic mistake that could lead to the situation when the cursor becomes disposed, but the corresponding iterator calls MoveNext or Current. In this case no exception was thrown and JNI handler mentioned above was called, which led to the exception in it, which led to the undefined behavior of Ignite.

I'll look if the issue is solved and will report on results.

回答1:

I can confirm that a race condition is possible if IQueryCursor<K, V> instance is used from multiple threads, and one thread disposes it while another enumerates it.

Query cursors are not thread-safe, they are supposed to be used from a single thread.

Ticket filed: https://issues.apache.org/jira/browse/IGNITE-12348



标签: ignite