Mikhail Petrov created IGNITE-29127:
---------------------------------------
Summary: Cache locks usage may lead to node failure with assertion
error during stopping
Key: IGNITE-29127
URL: https://issues.apache.org/jira/browse/IGNITE-29127
Project: Ignite
Issue Type: Task
Reporter: Mikhail Petrov
Reproducer:
{code:java}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.failure.StopNodeOrHaltFailureHandler;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.util.lang.RunnableX;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.internal.TestRecordingCommunicationSpi.spi;
/** */
public class ExplicitLockCancelOnNodeStopTest extends GridCommonAbstractTest {
/** */
private volatile RunnableX beforeStop;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
return super.getConfiguration(igniteInstanceName)
.setCommunicationSpi(new TestRecordingCommunicationSpi())
.setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
.setAtomicityMode(TRANSACTIONAL)
.setBackups(1))
.setFailureHandler(new StopNodeOrHaltFailureHandler())
.setLifecycleBeans(evt -> {
if (evt == LifecycleEventType.BEFORE_NODE_STOP)
beforeStop.run();
});
}
/** */
@Test
public void testLockOnStoppingNode() throws Exception {
Ignite srv = startGrid(0);
Ignite backup = startGrid(1);
awaitPartitionMapExchange();
IgniteCache<Integer, Integer> cache = srv.cache(DEFAULT_CACHE_NAME);
List<Integer> keys = primaryKeys(cache, 2);
cache.lock(keys.get(0)).lock();
spi(backup).blockMessages(GridDhtLockResponse.class, srv.name());
beforeStop = () -> {
try {
cache.lock(keys.get(1)).tryLock();
}
catch (Exception ignored) {
// No-op.
}
spi(backup).waitForBlocked();
spi(backup).stopBlock();
};
stopGrid(0);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)