Skip to content

Fix: disable JarURLConnection caching in GuidelineIO to prevent concurrent scan failures#151

Open
ic0ns wants to merge 1 commit intomainfrom
fix/jar-url-connection-caching
Open

Fix: disable JarURLConnection caching in GuidelineIO to prevent concurrent scan failures#151
ic0ns wants to merge 1 commit intomainfrom
fix/jar-url-connection-caching

Conversation

@ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Mar 24, 2026

Problem

GuidelineIO.listXmlFiles() calls jarConnection.getJarFile() which, by default, returns a shared, cached JarFile instance. When one TlsServerScanner instance finishes and its try-with-resources block closes the JarFile, any concurrent scanner that received the same cached handle fails with:

java.lang.IllegalStateException: zip file closed

This only manifests when running multiple concurrent scans from a JAR (production deployments), not in development mode where the file protocol is used.

Fix

Add jarConnection.setUseCaches(false) before calling getJarFile(). This causes the JDK to open a fresh, independent JarFile for each connection, so closing one does not affect others.

References


This PR was created with AI assistance.

…e issues

getJarFile() returns a shared, cached JarFile instance by default.
When one caller closes it via try-with-resources, concurrent callers
that received the same cached instance fail with "zip file closed".

Setting setUseCaches(false) before getJarFile() ensures each
JarURLConnection opens its own independent JarFile instance.

Fixes: tls-attacker/TLS-Scanner-Development#772

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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