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

Denis Chudov updated IGNITE-21634:
----------------------------------
    Description: 
{code:java}
Caused by: java.lang.NullPointerException at 
org.apache.ignite.internal.tx.impl.HeapLockManager.lambda$lockState$4(HeapLockManager.java:297)
 ~[main/:?] at 
java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) 
~[?:?] at 
org.apache.ignite.internal.tx.impl.HeapLockManager.lockState(HeapLockManager.java:291)
 ~[main/:?] at 
org.apache.ignite.internal.tx.impl.HeapLockManager.acquire(HeapLockManager.java:172)
 ~[main/:?] at 
org.apache.ignite.internal.table.distributed.SortedIndexLocker.lambda$locksForInsert$4(SortedIndexLocker.java:169)
 ~[main/:?] at 
java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
 ~[?:?] ... 29 more{code}
on the lineĀ {{v.markedForRemove = false;}}
{code:java}
private LockState lockState(LockKey key) {
    int h = spread(key.hashCode());
    int index = h & (slots.length - 1);

    LockState[] res = new LockState[1];

    locks.compute(key, (k, v) -> {
        if (v == null) {
            if (empty.isEmpty()) {
                res[0] = slots[index];
            } else {
                v = empty.poll();
                v.markedForRemove = false;
                v.key = k;
                res[0] = v;
            }
        } else {
            res[0] = v;
        }

        return v;
    });

    return res[0];
} {code}

  was:
{code:java}
Caused by: java.lang.NullPointerException at 
org.apache.ignite.internal.tx.impl.HeapLockManager.lambda$lockState$4(HeapLockManager.java:297)
 ~[main/:?] at 
java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) 
~[?:?] at 
org.apache.ignite.internal.tx.impl.HeapLockManager.lockState(HeapLockManager.java:291)
 ~[main/:?] at 
org.apache.ignite.internal.tx.impl.HeapLockManager.acquire(HeapLockManager.java:172)
 ~[main/:?] at 
org.apache.ignite.internal.table.distributed.SortedIndexLocker.lambda$locksForInsert$4(SortedIndexLocker.java:169)
 ~[main/:?] at 
java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
 ~[?:?] ... 29 more{code}


> NPE in HeapLockManager
> ----------------------
>
>                 Key: IGNITE-21634
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21634
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Denis Chudov
>            Priority: Major
>              Labels: ignite-3
>
> {code:java}
> Caused by: java.lang.NullPointerException at 
> org.apache.ignite.internal.tx.impl.HeapLockManager.lambda$lockState$4(HeapLockManager.java:297)
>  ~[main/:?] at 
> java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) 
> ~[?:?] at 
> org.apache.ignite.internal.tx.impl.HeapLockManager.lockState(HeapLockManager.java:291)
>  ~[main/:?] at 
> org.apache.ignite.internal.tx.impl.HeapLockManager.acquire(HeapLockManager.java:172)
>  ~[main/:?] at 
> org.apache.ignite.internal.table.distributed.SortedIndexLocker.lambda$locksForInsert$4(SortedIndexLocker.java:169)
>  ~[main/:?] at 
> java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
>  ~[?:?] ... 29 more{code}
> on the lineĀ {{v.markedForRemove = false;}}
> {code:java}
> private LockState lockState(LockKey key) {
>     int h = spread(key.hashCode());
>     int index = h & (slots.length - 1);
>     LockState[] res = new LockState[1];
>     locks.compute(key, (k, v) -> {
>         if (v == null) {
>             if (empty.isEmpty()) {
>                 res[0] = slots[index];
>             } else {
>                 v = empty.poll();
>                 v.markedForRemove = false;
>                 v.key = k;
>                 res[0] = v;
>             }
>         } else {
>             res[0] = v;
>         }
>         return v;
>     });
>     return res[0];
> } {code}



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

Reply via email to