Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-24334 Fixed flaky ClientSessionOutboundQueueLimitTest #11835

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
import org.apache.ignite.Ignition;
import org.apache.ignite.client.ClientCache;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.client.IgniteClientFuture;
import org.apache.ignite.client.events.ConnectionClosedEvent;
import org.apache.ignite.client.events.ConnectionEventListener;
import org.apache.ignite.configuration.ClientConfiguration;
import org.apache.ignite.configuration.ClientConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;

Expand Down Expand Up @@ -69,6 +68,8 @@ public void testClientSessionOutboundQueueLimit() throws Exception {
try (
IgniteClient cli = Ignition.startClient(new ClientConfiguration()
.setAddresses("127.0.0.1:10800")
.setTimeout(5000) // Server will drop packets intended for the client. So client can hang on handshake during reconnect.
.setRetryLimit(1) // Let's not retry operations if the channel was closed while waiting for a response.
.setEventListeners(new ConnectionEventListener() {
@Override public void onConnectionClosed(ConnectionClosedEvent event) {
isCliDisconnected.set(true);
Expand All @@ -85,11 +86,16 @@ public void testClientSessionOutboundQueueLimit() throws Exception {

skipClientWrite(grid(0), true);

Collection<IgniteInternalFuture<byte[]>> futs = new ArrayList<>();
Collection<IgniteClientFuture<byte[]>> futs = new ArrayList<>();

try {
while (!isCliDisconnected.get())
futs.add(GridTestUtils.runAsync(() -> cache.get(0)));
while (!isCliDisconnected.get()) {
futs.add(cache.getAsync(0));

// Slow and steady. This delay will give us a chance to stop spamming requests
// as soon as server disconnects the client.
U.sleep(10);
}
}
finally {
skipClientWrite(grid(0), false);
Expand All @@ -102,8 +108,6 @@ public void testClientSessionOutboundQueueLimit() throws Exception {
fut.get();
}
catch (Exception e) {
assertTrue(e.getMessage().contains("Channel is closed"));

failedReqsCntr.incrementAndGet();
}
});
Expand Down