You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that in some cases refreshSchema() can hang the thread calling it and not recover. Easy way to trigger this is to call it when connection to the cluster was just lost. It is expected that the refresh won't succeed in such case, but I'm assuming it should not hang the thread.
Steps to reproduce
Create the following test method (it's easier as a test because reproducer uses test-infra dependency):
@Test
public void reproducer() {
DriverConfigLoader loader =
new DefaultProgrammaticDriverConfigLoaderBuilder()
.withBoolean(TypedDriverOption.RECONNECT_ON_INIT.getRawOption(), true)
.withStringList(
TypedDriverOption.CONTACT_POINTS.getRawOption(),
Collections.singletonList("127.0.1.1:9042"))
.build();
CqlSessionBuilder builder = new CqlSessionBuilder().withConfigLoader(loader);
CqlSession session = null;
Collection<Node> nodes;
int counter = 0;
while (counter < 2) {
counter++;
try (CcmBridge ccmBridge =
CcmBridge.builder().withNodes(3).withIpPrefix("127.0." + counter + ".").build()) {
ccmBridge.create();
ccmBridge.start();
if (session == null) {
session = builder.build();
}
long endTime = System.currentTimeMillis() + CLUSTER_WAIT_SECONDS * 1000;
while (System.currentTimeMillis() < endTime) {
try {
nodes = session.getMetadata().getNodes().values();
int upNodes = 0;
for (Node node : nodes) {
if (node.getUpSinceMillis() > 0) {
upNodes++;
}
}
if (upNodes == 3) {
break;
}
System.out.println("Before refreshSchema call (n==" + counter +")");
session.refreshSchema();
System.out.println("# After refreshSchema call (n==" + counter +")");
Thread.sleep(1000);
} catch (InterruptedException e) {
break;
}
}
}
}
}
Add following logger to logback-test.xml to see the exception:
It seems that in some cases
refreshSchema()
can hang the thread calling it and not recover. Easy way to trigger this is to call it when connection to the cluster was just lost. It is expected that the refresh won't succeed in such case, but I'm assuming it should not hang the thread.Steps to reproduce
Create the following test method (it's easier as a test because reproducer uses test-infra dependency):
Add following logger to logback-test.xml to see the exception:
And run the method
Result
The test will hang at some point at
refreshSchema()
call. The following exception should be visible in the logsThe text was updated successfully, but these errors were encountered: