You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): prevent Stream closed on concurrent JAR access in TemplateManager (#23596)
When two Gradle tasks run concurrently in isolated classloaders that both
point to the same generator JAR, the JVM's JarFileFactory shares a single
JarFile between both classloaders. If one classloader is closed/GC'd while
the other is still copying a non-template resource (e.g. README.md), the
shared JarFile is closed and the other worker's InflaterInputStream throws
'Stream closed'.
Two fixes in TemplateManager:
1. getInputStream() now opens a fresh URLConnection with setUseCaches(false) for classpath resources, preventing the underlying JarFile from being shared across classloaders.
2. write() now wraps the InputStream in try-with-resources, fixing the pre-existing resource leak where the stream was never closed after the binary file copy.
0 commit comments