ignite-6175 JVM Crash in Ignite Binary Objects Simple Mapper Basic suite
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.GridStripedLock;
import org.apache.ignite.internal.util.IgniteTree;
+import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.SB;
@@ -112,11 +113,11 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
/** */
private static final Collection<Long> rmvdIds = new GridConcurrentHashSet<>();
+ /** Stop. */
+ private final AtomicBoolean stop = new AtomicBoolean();
-// /** {@inheritDoc} */
-// @Override protected long getTestTimeout() {
-// return 25 * 60 * 1000;
-// }
+ /** Future. */
+ private volatile GridCompoundFuture<?, ?> asyncRunFut;
/**
* Check that we do not keep any locks at the moment.
@@ -127,6 +128,8 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
+ stop.set(false);
+
long seed = System.nanoTime();
X.println("Test seed: " + seed + "L; // ");
@@ -156,6 +159,18 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
rnd = null;
try {
+ if (asyncRunFut != null && !asyncRunFut.isDone()) {
+ stop.set(true);
+
+ try {
+ asyncRunFut.cancel();
+ asyncRunFut.get(60000);
+ }
+ catch (Throwable ex) {
+ //Ignore
+ }
+ }
+
if (reuseList != null) {
long size = reuseList.recycledPagesCount();
@@ -1316,7 +1331,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
IgniteInternalFuture<?> fut = multithreadedAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
- for (int i = 0; i < loops; i++) {
+ for (int i = 0; i < loops && !stop.get(); i++) {
final Long x = (long)DataStructure.randomInt(CNT);
final int op = DataStructure.randomInt(4);
@@ -1402,8 +1417,6 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
}
}, Runtime.getRuntime().availableProcessors(), "put-remove");
- final AtomicBoolean stop = new AtomicBoolean();
-
IgniteInternalFuture<?> fut2 = multithreadedAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
while (!stop.get()) {
@@ -1442,14 +1455,22 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
}
}, 4, "find");
+
+ asyncRunFut = new GridCompoundFuture<>();
+
+ asyncRunFut.add((IgniteInternalFuture)fut);
+ asyncRunFut.add((IgniteInternalFuture)fut2);
+ asyncRunFut.add((IgniteInternalFuture)fut3);
+
+ asyncRunFut.markInitialized();
+
try {
fut.get(getTestTimeout(), TimeUnit.MILLISECONDS);
}
finally {
stop.set(true);
- fut2.get();
- fut3.get();
+ asyncRunFut.get();
}
GridCursor<Long> cursor = tree.find(null, null);
