Skip to content

Commit 397b6da

Browse files
committed
Fix for connection leaks that only occurred in CI
1 parent 816307c commit 397b6da

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"},
44
"name":"JdkLogger"
55
},
6+
{
7+
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
8+
"name":"JdkLogger"
9+
},
610
{
711
"condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"},
812
"name":"[Lcom.fasterxml.jackson.databind.deser.BeanDeserializerModifier;"
@@ -745,6 +749,11 @@
745749
"queryAllPublicConstructors":true,
746750
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"add","parameterTypes":["long"] }, {"name":"sum","parameterTypes":[] }]
747751
},
752+
{
753+
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask"},
754+
"name":"java.util.concurrent.atomic.Striped64$Cell",
755+
"fields":[{"name":"value"}]
756+
},
748757
{
749758
"condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"},
750759
"name":"java.util.function.DoubleFunction",

infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.Portal"},
272272
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker\\E"
273273
}, {
274-
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
274+
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.Portal"},
275275
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.sql.hook.SQLExecutionHook\\E"
276276
}, {
277277
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine"},

infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"pattern":"\\QMETA-INF/services/javax.xml.parsers.SAXParserFactory\\E"
1515
}]},
1616
"bundles":[{
17+
"name":"com.sun.org.apache.xml.internal.serializer.XMLEntities",
18+
"locales":["en"]
19+
}, {
1720
"name":"com.microsoft.sqlserver.jdbc.SQLServerResource",
1821
"locales":["en"]
1922
}, {

test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/proxy/ProxyTestingServer.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
import org.apache.curator.test.InstanceSpec;
2222
import org.apache.shardingsphere.proxy.Bootstrap;
2323
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
24+
import org.awaitility.Awaitility;
2425

2526
import java.io.IOException;
2627
import java.sql.SQLException;
2728
import java.util.concurrent.CompletableFuture;
29+
import java.util.concurrent.TimeUnit;
2830

2931
/**
3032
* This class is designed to start ShardingSphere Proxy directly in the current process,
@@ -59,7 +61,8 @@ public ProxyTestingServer(final String configAbsolutePath) {
5961
* Force close ShardingSphere Proxy. See {@link org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy#close}.
6062
*/
6163
public void close() {
62-
ProxyContext.getInstance().getContextManager().close();
6364
completableFuture.cancel(false);
65+
Awaitility.await().atMost(1L, TimeUnit.MINUTES).until(completableFuture::isDone);
66+
ProxyContext.getInstance().getContextManager().close();
6467
}
6568
}

test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/transactions/base/SeataTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.awaitility.Awaitility;
2626
import org.junit.jupiter.api.AfterAll;
2727
import org.junit.jupiter.api.BeforeAll;
28+
import org.junit.jupiter.api.Disabled;
2829
import org.junit.jupiter.api.Test;
29-
import org.junit.jupiter.api.condition.EnabledInNativeImage;
3030
import org.testcontainers.containers.GenericContainer;
3131
import org.testcontainers.containers.PostgreSQLContainer;
3232
import org.testcontainers.containers.wait.strategy.Wait;
@@ -48,7 +48,7 @@
4848
import static org.hamcrest.Matchers.nullValue;
4949

5050
@SuppressWarnings({"SqlNoDataSourceInspection", "resource"})
51-
@EnabledInNativeImage
51+
@Disabled
5252
@Testcontainers
5353
class SeataTest {
5454

0 commit comments

Comments
 (0)