[
https://issues.apache.org/jira/browse/IGNITE-29127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mikhail Petrov updated IGNITE-29127:
------------------------------------
Description:
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}
Node failure error:
{code:java}
java.lang.AssertionError
at
org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan.markOwned(GridCacheExplicitLockSpan.java:246)
at
org.apache.ignite.internal.processors.cache.GridCacheMvccManager.markExplicitOwner(GridCacheMvccManager.java:1041)
at
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.markLocalDhtLocksAcquired(GridDhtColocatedLockFuture.java:1332)
at
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.lambda$lockLocally$fe0aeeed$1(GridDhtColocatedLockFuture.java:1299)
at
org.apache.ignite.internal.util.future.GridEmbeddedFuture$1.applyx(GridEmbeddedFuture.java:54)
at
org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:292)
at
org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:285)
at
org.apache.ignite.internal.thread.context.function.OperationContextAwareInClosure.apply(OperationContextAwareInClosure.java:38)
{code}
was:
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}
> 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: Bug
> Reporter: Mikhail Petrov
> Priority: Major
>
> 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}
> Node failure error:
> {code:java}
> java.lang.AssertionError
> at
> org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan.markOwned(GridCacheExplicitLockSpan.java:246)
> at
> org.apache.ignite.internal.processors.cache.GridCacheMvccManager.markExplicitOwner(GridCacheMvccManager.java:1041)
> at
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.markLocalDhtLocksAcquired(GridDhtColocatedLockFuture.java:1332)
> at
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.lambda$lockLocally$fe0aeeed$1(GridDhtColocatedLockFuture.java:1299)
> at
> org.apache.ignite.internal.util.future.GridEmbeddedFuture$1.applyx(GridEmbeddedFuture.java:54)
> at
> org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:292)
> at
> org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:285)
> at
> org.apache.ignite.internal.thread.context.function.OperationContextAwareInClosure.apply(OperationContextAwareInClosure.java:38)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)