Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARTEMIS-2108 Potential StackOverflowError when load balancing disabled
(cherry picked from commit d336a09)
- Loading branch information
1 parent
70a70f4
commit b6945b5
Showing
2 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...artemis/tests/integration/cluster/distribution/RemoteBindingWithoutLoadBalancingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* 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.activemq.artemis.tests.integration.cluster.distribution; | ||
|
||
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; | ||
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class RemoteBindingWithoutLoadBalancingTest extends ClusterTestBase { | ||
|
||
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER; | ||
|
||
@Override | ||
@Before | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
|
||
setupServers(); | ||
} | ||
|
||
protected boolean isNetty() { | ||
return false; | ||
} | ||
|
||
/** | ||
* It's possible that when a cluster has disabled message load balancing then a message | ||
* sent to a node that only has a corresponding remote queue binding will trigger a | ||
* stack overflow. | ||
*/ | ||
@Test | ||
public void testStackOverflow() throws Exception { | ||
setupCluster(); | ||
|
||
startServers(); | ||
|
||
setupSessionFactory(0, isNetty()); | ||
setupSessionFactory(1, isNetty()); | ||
|
||
createQueue(0, "queues.testaddress", "queue0", null, false); | ||
|
||
waitForBindings(0, "queues.testaddress", 1, 0, true); | ||
|
||
waitForBindings(1, "queues.testaddress", 1, 0, false); | ||
|
||
send(1, "queues.testaddress", 1, false, null); | ||
} | ||
|
||
protected void setupCluster() throws Exception { | ||
setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.OFF, 1, isNetty(), 0, 1); | ||
|
||
setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.OFF, 1, isNetty(), 1, 0); | ||
} | ||
|
||
protected void setupServers() throws Exception { | ||
setupServer(0, isFileStorage(), isNetty()); | ||
setupServer(1, isFileStorage(), isNetty()); | ||
} | ||
|
||
protected void startServers() throws Exception { | ||
startServers(0, 1); | ||
} | ||
|
||
protected void stopServers() throws Exception { | ||
closeAllConsumers(); | ||
|
||
closeAllSessionFactories(); | ||
|
||
closeAllServerLocatorsFactories(); | ||
|
||
stopServers(0, 1); | ||
} | ||
|
||
@Override | ||
protected boolean isFileStorage() { | ||
return false; | ||
} | ||
} |