[
https://issues.apache.org/jira/browse/IGNITE-21634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konstantin Orlov 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}
The problem can be reproduced on main(71b4fb34) with following test (probably,
fsync should be turned off):
{code}
@Test
void test() {
sql("CREATE TABLE test("
+ "c1 INT PRIMARY KEY, c2 INT, c3 INT, c4 INT, c5 INT,"
+ "c6 INT, c7 INT, c8 INT, c9 INT, c10 INT)"
);
for (int i = 2; i <= 10; i++) {
sql(format("CREATE INDEX c{}_idx ON test (c{})", i, i));
}
sql("INSERT INTO test"
+ " SELECT x as c1, x as c2, x as c3, x as c4, x as c5, "
+ " x as c6, x as c7, x as c8, x as c9, x as c10"
+ " FROM TABLE (system_range(1, 100000))");
}
{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}
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}
> 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}
> The problem can be reproduced on main(71b4fb34) with following test
> (probably, fsync should be turned off):
> {code}
> @Test
> void test() {
> sql("CREATE TABLE test("
> + "c1 INT PRIMARY KEY, c2 INT, c3 INT, c4 INT, c5 INT,"
> + "c6 INT, c7 INT, c8 INT, c9 INT, c10 INT)"
> );
> for (int i = 2; i <= 10; i++) {
> sql(format("CREATE INDEX c{}_idx ON test (c{})", i, i));
> }
> sql("INSERT INTO test"
> + " SELECT x as c1, x as c2, x as c3, x as c4, x as c5, "
> + " x as c6, x as c7, x as c8, x as c9, x as c10"
> + " FROM TABLE (system_range(1, 100000))");
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)