Fix TLS connection mismatch in PVAClient tcp_handlers map#3778
Merged
kasemir merged 1 commit intoControlSystemStudio:masterfrom Apr 15, 2026
Merged
Conversation
|
kasemir
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Problem
PVAClient.tcp_handlersis aConcurrentHashMapkeyed byInetSocketAddressalone. When a plain-TCP search response arrives for the sameaddress:portbefore the TLS response,computeIfAbsentreturns the stale plain-TCP handler and the connection is permanently stuck on plain TCP for that address — even after the TLS search response arrives.Root Cause
The map key does not encode the TLS flag, so a plain-TCP entry silently shadows any later request to open a TLS connection to the same socket address.
Fix
tls_disabledflag toPVAClient(defaultfalse).tls_disabled=true, forceuse_tls=falsein thecomputeIfAbsentlambda so the map is always populated with a plain-TCP handler, regardless of what the search response advertises.tls_disabledthrough toChannelSearchso search requests never advertise TLS support when disabled, preventing servers from ever replying with a TLS flag.PVAClient(boolean tls_disabled)constructor for callers that need a plain-TCP client (e.g., theCertificateStatusMonitor, which must avoid infinite recursion).Files Changed
core/pva/src/main/java/org/epics/pva/client/PVAClient.javacore/pva/src/main/java/org/epics/pva/client/ChannelSearch.java