Skip to content

Fix Windows CI failures: close TLS cert streams and stop leaking metrics system properties in tests - #16616

Merged
EarthChen merged 2 commits into
apache:3.3from
EarthChen:fix/ci-test-flaky
Nov 28, 2026
Merged

EarthChen merged 2 commits into
apache:3.3from
EarthChen:fix/ci-test-flaky

Conversation

@EarthChen

@EarthChen EarthChen commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the two persistent unit-test failures on the 3.3 branch CI (Windows jobs red since #16590, SpringBootConfigMetricsTest failing intermittently on ubuntu):

SSLConfigCertProvider.getConsumerConnectionConfig()
- IOUtils.toByteArray(sslConfig.getClientKeyCertChainPathStream())
+ readAll(sslConfig.getClientKeyCertChainPathStream())   # try-with-resources
  1. SSLConfigCertProvider leaked one FileInputStream per certificate file on every TLS connection. IOUtils.toByteArray(InputStream) does not close its input. On Linux/macOS deleting an open file succeeds, but on Windows the open handle blocks deletion of the JUnit @TempDir, so ClientTlsHostnameVerificationTest (introduced by Pass the peer address to the TCP TLS client engine #16590) errored with Failed to close extension context ... ca.pem, client.key, client.pem — exactly the three files this provider reads. The leaked files list matches the streams opened here one-to-one; the server-side SslContextBuilder.forServer(File, File) reads (closed by Netty) never appeared in the failure. This is also a production fd leak (one per cert per connection attempt).

  2. AnnotationIsolationTest set dubbo.metrics.protocol=disabled via SysProps and never cleaned it up. Dubbo resolves dubbo.metrics.* from system properties with the highest precedence, so any later test class in the same JVM failed. SpringBootConfigMetricsTest died with expected: <prometheus> but was: <disabled>. fix: make SpringBootConfigPropsTest immune to leaked metrics System properties #16420 already added the System.clearProperty guard to SpringBootConfigPropsTest; this adds the same guard to SpringBootConfigMetricsTest and removes the leak source in AnnotationIsolationTest (@AfterEach).

The Samples Test Build test image failures seen on the same runs are unrelated: the nacos-mysql sample Dockerfile hit a transient HTTP 503 pulling mysql-schema.sql from GitHub.

Evidence

Reproduced locally on 3.3 (macOS, JDK 17) by injecting the leaked property, mirroring the CI failure mechanism:

# before
$ ./mvnw -pl dubbo-config/dubbo-config-spring -am test -Dtest=SpringBootConfigMetricsTest -Ddubbo.metrics.protocol=disabled
SpringBootConfigMetricsTest.testMetrics:78 expected: <prometheus> but was: <disabled>
BUILD FAILURE

# after (same command)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

Full regression on the touched module (matches the CI test count):

$ ./mvnw -pl dubbo-config/dubbo-config-spring test
Tests run: 147, Failures: 0, Errors: 0, Skipped: 30
BUILD SUCCESS
$ ./mvnw -pl dubbo-remoting/dubbo-remoting-netty4 -am test -Dtest=ClientTlsHostnameVerificationTest,SSLConfigCertProviderTest
Tests run: 6/6 + 3/3, Failures: 0, Errors: 0
BUILD SUCCESS

Note: the Windows-only @TempDir deletion failure cannot be reproduced on macOS (Linux/macOS allow deleting open files); the fix closes the exact handles the CI stack trace reported as undeletable. The Windows CI legs are the final verifier.

Merge Danger

Door: two-way

Blast Radius: small — closing streams that are already fully consumed (read to byte[]) before use; no behavior change on Linux/macOS, removes a production fd leak on all platforms. Test-only changes besides SSLConfigCertProvider.

The streams returned by SslConfig.getXxxPathStream() are file-backed and
IOUtils.toByteArray() does not close them. Every TLS connection therefore
leaked one FileInputStream per certificate file. On Windows an open handle
blocks deletion of the file, which made JUnit @tempdir cleanup fail in
ClientTlsHostnameVerificationTest and broke the Windows CI jobs
(see apache#16590's follow-up).

Signed-off-by: earthchen <earthchen@apache.org>
…st classes

AnnotationIsolationTest set dubbo.metrics.protocol=disabled via SysProps
and never cleared it. Dubbo resolves dubbo.metrics.* from system
properties with the highest precedence, so any later test class in the
same JVM (e.g. SpringBootConfigMetricsTest) failed with 'expected
<prometheus> but was <disabled>'.

- clear the properties in AnnotationIsolationTest's @AfterEach
- guard SpringBootConfigMetricsTest the same way SpringBootConfigPropsTest
  already does since apache#16420

Signed-off-by: earthchen <earthchen@apache.org>
@EarthChen
EarthChen merged commit 09a5747 into apache:3.3 Nov 28, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant