Description
If a region entry is destroyed at the same time that a CQ is executed, there exists a race condition where a non-destroyed NonTXEntry is retrieved during iteration of results in CompiledSelect.doNestedIterations() but is marked as destroyed/removed before NonTXEntry.getValue() is called in CompiledComparison.evaluate(), which results in an EntryDestroyedException being thrown.
org.apache.geode.cache.query.CqException: Failed to execute the CQ. CqName: testCQ, Query String is: SELECT * FROM /testRegion entry WHERE entry = NULL, Error from last server: remote server on 10.212.3.32(84004:loner):49205:d737a530: While performing a remote createCQfetchInitialResult at org.apache.geode.cache.query.cq.internal.ClientCQImpl.executeCqOnRedundantsAndPrimary(ClientCQImpl.java:435) at org.apache.geode.cache.query.cq.internal.ClientCQImpl.executeWithInitialResults(ClientCQImpl.java:303) at org.apache.geode.cache.query.cq.DonalCQTest.lambda$test$bb17a952$2(DonalCQTest.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.geode.test.dunit.internal.MethodInvoker.executeObject(MethodInvoker.java:123) at org.apache.geode.test.dunit.internal.RemoteDUnitVM.executeMethodOnObject(RemoteDUnitVM.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.geode.cache.client.ServerOperationException: remote server on 10.212.3.32(84004:loner):49205:d737a530: While performing a remote createCQfetchInitialResult at org.apache.geode.cache.client.internal.AbstractOp.processChunkedResponse(AbstractOp.java:340) at org.apache.geode.cache.client.internal.QueryOp$QueryOpImpl.processResponse(QueryOp.java:168) at org.apache.geode.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:222) at org.apache.geode.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:195) at org.apache.geode.cache.client.internal.AbstractOp.attempt(AbstractOp.java:382) at org.apache.geode.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:283) at org.apache.geode.cache.client.internal.QueueConnectionImpl.execute(QueueConnectionImpl.java:191) at org.apache.geode.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:753) at org.apache.geode.cache.client.internal.OpExecutorImpl.executeOnQueuesAndReturnPrimaryResult(OpExecutorImpl.java:454) at org.apache.geode.cache.client.internal.PoolImpl.executeOnQueuesAndReturnPrimaryResult(PoolImpl.java:870) at org.apache.geode.cache.query.cq.internal.ops.CreateCQWithIROp.execute(CreateCQWithIROp.java:45) at org.apache.geode.cache.query.cq.internal.ops.ServerCQProxyImpl.createWithIR(ServerCQProxyImpl.java:88) at org.apache.geode.cache.query.cq.internal.ClientCQImpl.executeCqOnRedundantsAndPrimary(ClientCQImpl.java:404) ... 25 more Caused by: org.apache.geode.cache.EntryDestroyedException: key at org.apache.geode.internal.cache.NonTXEntry.basicGetEntry(NonTXEntry.java:65) at org.apache.geode.internal.cache.NonTXEntry.getValue(NonTXEntry.java:94) at org.apache.geode.internal.cache.NonTXEntry.getValue(NonTXEntry.java:89) at org.apache.geode.cache.query.internal.CompiledComparison.evaluate(CompiledComparison.java:91) at org.apache.geode.cache.query.internal.CompiledSelect.doNestedIterations(CompiledSelect.java:779) at org.apache.geode.cache.query.internal.CompiledSelect.doNestedIterations(CompiledSelect.java:849) at org.apache.geode.cache.query.internal.CompiledSelect.doIterationEvaluate(CompiledSelect.java:706) at org.apache.geode.cache.query.internal.CompiledSelect.evaluate(CompiledSelect.java:548) at org.apache.geode.cache.query.internal.CompiledSelect.evaluate(CompiledSelect.java:54) at org.apache.geode.cache.query.internal.DefaultQuery.executeUsingContext(DefaultQuery.java:357) at org.apache.geode.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:264) at org.apache.geode.cache.query.internal.DefaultQuery.execute(DefaultQuery.java:197) at org.apache.geode.internal.cache.tier.sockets.BaseCommandQuery.processQueryUsingParams(BaseCommandQuery.java:122) at org.apache.geode.internal.cache.tier.sockets.BaseCommandQuery.processQuery(BaseCommandQuery.java:68) at org.apache.geode.cache.query.cq.internal.command.ExecuteCQ61.cmdExecute(ExecuteCQ61.java:183) at org.apache.geode.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:183) at org.apache.geode.internal.cache.tier.sockets.ServerConnection.doNormalMessage(ServerConnection.java:848) at org.apache.geode.internal.cache.tier.sockets.OriginalServerConnection.doOneMessage(OriginalServerConnection.java:72) at org.apache.geode.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1212) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.geode.internal.cache.tier.sockets.AcceptorImpl.lambda$initializeServerConnectionThreadPool$3(AcceptorImpl.java:686) at org.apache.geode.logging.internal.executors.LoggingThreadFactory.lambda$newThread$0(LoggingThreadFactory.java:119) ... 1 more
Surrounding the calls to NonTXEntry.getValue() in CompiledComparison.evaluate() with a try/catch block that handles the EntryDestroyedException will prevent this failure.
Attachments
Issue Links
- links to