-
Notifications
You must be signed in to change notification settings - Fork 658
Fix intermittent shouldFailWhenUsingEmptyServerKeyStore test failure across platforms
#1094
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
Conversation
…suites Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
|
@copilot looking better, but there currently still its the problem on windows with jdk 21. Any other ideas? |
Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
I've updated the fix to use a comprehensive list of certificate-requiring cipher suites instead of the single parameterized suite. The new The list explicitly excludes anonymous suites and provides fallback options so the SSL handshake will always require a certificate, making the test deterministic. Changes in commit eb7a664. |
|
@the-thing what do you think? I would say there are definitely less failures. I did not see macos failures for the last few runs. There only was one on windows with JDK21, so maybe the issue is not completely fixed. Will do some more runs... Edit: just realized there actually was a macos failure with JDK 21, now on Edit2: we now have a failure on JDK11 on macos, too. :-/ But the proposal sounded good at first sight... |
|
I don't know what is this happening. Sometimes they succeed, sometimes they fail which suggests that this is timeout based. I assume that the MacOS image should always be the same with the same features and version between runs? This is either
When old TravisCI was a thing I remember checking out Travis docker image and running it locally, but I'm not sure how easy this is to replicate for GitHub actions. This just requires sitting with a debugger locally on MacOS locally. |
|
@the-thing I don't have a mac or macos image around. :) The images seem to be the same (these are the ones for the JDK11 and JDK21 job: Re timeouts: Junie suggested to increase the timeout: #1096 |
|
Somebody will have to debug this at some point probably (hope it is not me ;)). It seems that none of use will have access to Mac... I guess timeouts will not hurt. Good thing is that probably MacOS is not heavily used to run FIX engines. That's not the best idea, but disabling this test class for MacOS. Is this even an option? |
|
No, I do not want to disable it. It is OK for me to re-run it in case of error. I think/hope it will probably not a problem in the real world. ;) |
... as suggested by Junie in #1095
shouldFailWhenUsingEmptyServerKeyStore test failure across platforms
The test intermittently fails on macOS and Windows because it passes
nullfor cipher suites, allowing the JVM to select defaults. Some platforms enable anonymous DH cipher suites by default, which don't require server certificates and succeed even with an empty keystore.Changes
CERTIFICATE_REQUIRED_CIPHER_SUITESconstant with a comprehensive list of certificate-requiring cipher suites for cross-platform compatibilityshouldFailWhenUsingEmptyServerKeyStoreinstead ofnullor parameterized single cipher suitesThe comprehensive cipher suite list ensures that at least one certificate-requiring suite will be available regardless of platform or JDK version, preventing the handshake from succeeding with an empty keystore and making the test deterministic.
Original prompt
This section details on the original issue you should resolve
<issue_title>Intermittent test failure on
SSLCertificateTest.shouldFailWhenUsingEmptyServerKeyStore</issue_title><issue_description>Sometimes it fails with
SSLCertificateTest.shouldFailWhenUsingEmptyServerKeyStore:808 No SSL exception thrown, it seems especially on macos.</issue_description><agent_instructions>Please create a PR with the suggested changes. </agent_instructions>
Comments on the Issue (you are @copilot in this section)
@chrjohn ## CopilotIt’s likely a platform-dependent handshake behavior due to cipher suite defaults. In this test, both acceptor and initiator are created with enabledCipherSuites = null and enabledProtocols = null, which means “use JVM defaults.” On macOS (depending on the JDK/JSSE provider and version), default-enabled cipher suites can include anonymous Diffie-Hellman suites (e.g., TLS_ECDH_anon_* or SSL_DH_anon_*). Anonymous suites do not use server certificates, so an “empty server keystore” does not cause the TLS handshake to fail. That would explain the intermittent “No SSL exception thrown,” especially on macOS.
Where this surfaces in the test:
The assertion that sometimes fails is:
Why it’s flaky:
Recommendations to make the test deterministic:
Explicitly disable anonymous cipher suites in this test (and optionally in the test harness):
Optionally, also restrict enabledProtocols to modern TLS versions (TLSv1.2/TLSv1.3) to avoid legacy behaviors.
Example change outline:
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_AES_128_CBC_SHA",
"TLS_RSA_WITH_AES_256_CBC_SHA"
};
This ensures the handshake requires a server certificate and will fail with an empty keystore, causing assertSslExceptionThrown to pass consistently across platforms.
Additional notes:
SSLCertificateTest.shouldFailWhenUsingEmptyServerKeyStore#1093💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.