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

Vyacheslav Koptilin updated IGNITE-20492:
-----------------------------------------
    Ignite Flags:   (was: Docs Required,Release Notes Required)

> NPE in PartitionReplicaListener's primary replica retrieval
> -----------------------------------------------------------
>
>                 Key: IGNITE-20492
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20492
>             Project: Ignite
>          Issue Type: Bug
>            Reporter:  Kirill Sizov
>            Priority: Major
>              Labels: ignite-3
>
> PartitionReplicaListener.ensureReplicaIsPrimary has the following block of 
> code
> {code:java}
> if (expectedTerm != null) {
>             return placementDriver.getPrimaryReplica(replicationGroupId, now)
>                     .thenCompose(primaryReplica -> {
>                                 long currentEnlistmentConsistencyToken = 
> primaryReplica.getStartTime().longValue();
>  {code}
> However, according to the placementDriver's contract, {{getPrimaryReplica}} 
> can complete with null:
> {quote}
> Same as awaitPrimaryReplica(ReplicationGroupId, HybridTimestamp) despite the 
> fact that given method await logic is bounded. It will wait for a primary 
> replica for a reasonable period of time, and complete a future with null if a 
> matching lease isn't found. Generally speaking reasonable here means enough 
> for distribution across cluster nodes.
> {quote}
> In that case ensureReplicaIsPrimary will crash with NPE:
> {noformat}
>   ... 3 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener.lambda$ensureReplicaIsPrimary$155(PartitionReplicaListener.java:2397)
>  ~[ignite-table-3.0.0-SNAPSHOT.jar:?]
>   at 
> java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
>  ~[?:?]
>   at 
> java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
>  ~[?:?]
>   at 
> java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073) 
> ~[?:?]
>   at 
> org.apache.ignite.internal.util.PendingComparableValuesTracker.lambda$completeWaitersOnUpdate$0(PendingComparableValuesTracker.java:169)
>  ~[ignite-core-3.0.0-SNAPSHOT.jar:?]
>   at java.util.concurrent.ConcurrentMap.forEach(ConcurrentMap.java:122) ~[?:?]
>   at 
> org.apache.ignite.internal.util.PendingComparableValuesTracker.completeWaitersOnUpdate(PendingComparableValuesTracker.java:169)
>  ~[ignite-core-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.util.PendingComparableValuesTracker.update(PendingComparableValuesTracker.java:103)
>  ~[ignite-core-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.metastorage.server.time.ClusterTimeImpl.updateSafeTime(ClusterTimeImpl.java:146)
>  ~[ignite-metastorage-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl.onSafeTimeAdvanced(MetaStorageManagerImpl.java:849)
>  ~[ignite-metastorage-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl$1.onSafeTimeAdvanced(MetaStorageManagerImpl.java:456)
>  ~[ignite-metastorage-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.metastorage.server.WatchProcessor.invokeOnRevisionCallback(WatchProcessor.java:247)
>  ~[ignite-metastorage-3.0.0-SNAPSHOT.jar:?]
>   at 
> org.apache.ignite.internal.metastorage.server.WatchProcessor.lambda$notifyWatches$2(WatchProcessor.java:148)
>  ~[ignite-metastorage-3.0.0-SNAPSHOT.jar:?]
>   at 
> java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
>  ~[?:?]
>   at 
> java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
>  ~[?:?]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to