[ https://issues.apache.org/jira/browse/IGNITE-15045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17387537#comment-17387537 ]
Pavel Pereslegin commented on IGNITE-15045: ------------------------------------------- [~ptupitsyn], thanks, updated the patch, could you take another look, please? > .NET: Continuous query with enabled security produces NullPointerException > -------------------------------------------------------------------------- > > Key: IGNITE-15045 > URL: https://issues.apache.org/jira/browse/IGNITE-15045 > Project: Ignite > Issue Type: Bug > Affects Versions: 2.11 > Reporter: Alexandr > Assignee: Pavel Pereslegin > Priority: Major > Labels: .NET > Attachments: ListenerService.cs, st1.txt, st2.txt > > Time Spent: 0.5h > Remaining Estimate: 0h > > With the security enabled without specifying eventFilter on ContinuousQuery, > we get an error: CacheEntryEventFilter failed: > java.lang.NullPointerException. This error does not reproduce on java but is > stable on C# > {code:java} > java.lang.NullPointerException > at > org.apache.ignite.internal.processors.cache.query.continuous.SecurityAwareFilter.evaluate(SecurityAwareFilter.java:61) > at > org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler.filter(CacheContinuousQueryHandler.java:1013) > at > org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$2.onEntryUpdated(CacheContinuousQueryHandler.java:473) > at > org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.onEntryUpdated(CacheContinuousQueryManager.java:447) > at > org.apache.ignite.internal.processors.cache.GridCacheMapEntry.innerUpdate(GridCacheMapEntry.java:2513) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2654) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.update(GridDhtAtomicCache.java:2114) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:1931) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtomicCache.java:1724) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(GridDhtAtomicCache.java:3293) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$400(GridDhtAtomicCache.java:146) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:287) > at > org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:282) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1142) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:591) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:392) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:318) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$100(GridCacheIoManager.java:109) > at > org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:308) > at > org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1908) > at > org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1529) > at > org.apache.ignite.internal.managers.communication.GridIoManager.access$5300(GridIoManager.java:242) > at > org.apache.ignite.internal.managers.communication.GridIoManager$9.execute(GridIoManager.java:1422) > at > org.apache.ignite.internal.managers.communication.TraceRunnable.run(TraceRunnable.java:55) > at > org.apache.ignite.internal.util.StripedExecutor$Stripe.body(StripedExecutor.java:569) > at > org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120) > at java.lang.Thread.run(Thread.java:748) > {code} > This seems to be because _PlatformContinuousQueryImpl_ sets himself as a > remote filter by default (as a wrapper, see > _PlatformContinuousQueryImpl#start_ and > _PlatformContinuousQueryImpl#evaluate_), but serializes only the real filter > if it exists (_PlatformContinuousQueryImpl#writeReplace)_, so we wrap the > _PlatformContinuousQueryImpl_ with a _SecurityAwareFilter_, but the original > _PlatformContinuousQueryImpl_ filter is serialized to _null_ because no real > filter was set. > Reproducer: > {code:c#} > public class ContinuousQuerySecurityEnabledTest > { > private static readonly string TempDir = PathUtils.GetTempDirectoryName(); > > private static ListLogger _logger = new ListLogger(new ConsoleLogger()) > { > EnabledLevels = new[] {LogLevel.Error} > }; > [Test] > [Category(TestUtils.CategoryIntensive)] > public void TestQuerySecurityEnabled() > { > using (var ignite = StartIgnite()) > { > using (StartIgnite()) > { > ignite.GetCluster().SetActive(true); > var cache = ignite.CreateCache<int, string>("TEST"); > cache.QueryContinuous(new ContinuousQuery<int, string>(new > LocalListener())); > for (int i = 0; i < 100; i++) > cache.Put(i, "test" + i); > var errs = _logger.Entries.FindAll( > e => e.Message.Contains("CacheEntryEventFilter failed: > java.lang.NullPointerException")); > Assert.AreEqual(0, errs.Count); > } > } > } > [Serializable] > class LocalListener : ICacheEntryEventListener<int, string> > { > public void OnEvent(IEnumerable<ICacheEntryEvent<int, string>> evts) > { > // No-op. > } > } > > private static IIgnite StartIgnite() > { > return Ignition.Start(new > IgniteConfiguration(TestUtils.GetTestConfiguration()) > { > AutoGenerateIgniteInstanceName = true, > DataStorageConfiguration = new DataStorageConfiguration > { > DefaultDataRegionConfiguration = new DataRegionConfiguration > { > PersistenceEnabled = true, > Name = "default", > } > }, > AuthenticationEnabled = true, > WorkDirectory = TempDir, > Logger = _logger > }); > } > [TearDown] > public void TearDown() > { > _logger.Clear(); > Directory.Delete(TempDir, true); > } > } > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)