Skip to content

Stream closed exception during Spring application startup #6704

Closed

Description

@feser

We started to get errors during Spring application startup when we upgraded com.datadoghq:dd-java-agent to 1.29.0.

org.springframework.asm.ClassReader.readStream gets java.io.IOException: Stream closed randomly.

We have verified that we don't have this issue with dd-java-agent:1.28.0.

Spring boot version: 3.2.2

Stack trace:

org.springframework.beans.factory.BeanDefinitionStoreException: I/O failure while processing configuration class [com.test.TestApplication]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:251)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:416)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:289)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:788)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
    at com.test.TestApplicationKt.main(TestApplication.kt:20)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
    at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)

Caused by: java.io.IOException: Stream closed
    at java.base/java.util.zip.InflaterInputStream.ensureOpen(Unknown Source)
    at java.base/java.util.zip.InflaterInputStream.read(Unknown Source)
    at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:57)
    at org.springframework.boot.loader.net.protocol.jar.LazyDelegatingInputStream.read(LazyDelegatingInputStream.java:43)
    at org.springframework.asm.ClassReader.readStream(ClassReader.java:322)
    at org.springframework.asm.ClassReader.<init>(ClassReader.java:287)
    at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:56)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
    at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)
    at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)

Activity

  1. smola commented on Feb 20, 2024

    @smola
    Member

    @feser Thank you for reporting this. This is a bug introduced by #6603 in v1.29.0. We're working on a fix and will publish a release as soon as possible.

    Best course of action right now is staying at v1.28.0 until we release the hotfix. Otherwise, the bug can be prevented by disabling dependency scanning with (-Ddd.telemetry.dependency-collection.enabled=false or DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED=false). Just keep in mind that would lead to loss of functionality for anything related to dependencies.

  2. self-assigned this
    on Feb 20, 2024
  3. added this to the 1.30.1 milestone on Feb 21, 2024
  4. github-actions commented on Feb 21, 2024

    @github-actions
    Contributor

    🤖 This issue has been addressed in the latest release. See full details in the Release Notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions