Skip to content

Commit

Permalink
Fix for connection leaks that only occurred in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Jan 14, 2025
1 parent 816307c commit 397b6da
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"},
"name":"JdkLogger"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
"name":"JdkLogger"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"},
"name":"[Lcom.fasterxml.jackson.databind.deser.BeanDeserializerModifier;"
Expand Down Expand Up @@ -745,6 +749,11 @@
"queryAllPublicConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"add","parameterTypes":["long"] }, {"name":"sum","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask"},
"name":"java.util.concurrent.atomic.Striped64$Cell",
"fields":[{"name":"value"}]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"},
"name":"java.util.function.DoubleFunction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.Portal"},
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker\\E"
}, {
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.Portal"},
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.sql.hook.SQLExecutionHook\\E"
}, {
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"pattern":"\\QMETA-INF/services/javax.xml.parsers.SAXParserFactory\\E"
}]},
"bundles":[{
"name":"com.sun.org.apache.xml.internal.serializer.XMLEntities",
"locales":["en"]
}, {
"name":"com.microsoft.sqlserver.jdbc.SQLServerResource",
"locales":["en"]
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
import org.apache.curator.test.InstanceSpec;
import org.apache.shardingsphere.proxy.Bootstrap;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.awaitility.Awaitility;

import java.io.IOException;
import java.sql.SQLException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

/**
* This class is designed to start ShardingSphere Proxy directly in the current process,
Expand Down Expand Up @@ -59,7 +61,8 @@ public ProxyTestingServer(final String configAbsolutePath) {
* Force close ShardingSphere Proxy. See {@link org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy#close}.
*/
public void close() {
ProxyContext.getInstance().getContextManager().close();
completableFuture.cancel(false);
Awaitility.await().atMost(1L, TimeUnit.MINUTES).until(completableFuture::isDone);
ProxyContext.getInstance().getContextManager().close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
Expand All @@ -48,7 +48,7 @@
import static org.hamcrest.Matchers.nullValue;

@SuppressWarnings({"SqlNoDataSourceInspection", "resource"})
@EnabledInNativeImage
@Disabled
@Testcontainers
class SeataTest {

Expand Down

0 comments on commit 397b6da

Please sign in to comment.