Skip to content

Out of Memory when using spring-boot-starter-webflux #4670

@andrescallev

Description

@andrescallev

Integration

sentry-spring-boot-starter-jakarta

Java Version

21

Version

8.20.0

Steps to Reproduce

Currently using spring boot 3.5.5

And having the dependencies

  • spring-boot-starter-webflux

  • sentry-spring-boot-starter-jakarta (8.20.0)

  • sentry-logback (8.20.0)

yml configuration for sentry:
sentry: enabled: false dsn: ${SENTRY_DSN} send-default-pii: true environment: ${spring.profiles.active} release: '@project.version@' tracesSampleRate: 0.1 logging: enabled: true minimum-event-level: ERROR

We have a microservice that consumes events from Azure Event Hub and Kafka with Spring Cloud Streams, and some flows sends HTTP requests with an org.springframework.web.reactive.function.client.WebClient;.

With those dependencies once you startup the API the memory increase until reach the top of memory allocated
We increased the memory limit to 3.5G and it used all

Sentry SDK starts to consumes all the memory with reactor objects

The solution that we found was to
@SpringBootApplication( exclude = { io.sentry.spring.boot.jakarta.SentryWebfluxAutoConfiguration.class } )

And
`
@configuration
@ConditionalOnProperty(name = "sentry.enabled", havingValue = "true")
public class SentryConfig {

@PostConstruct
public void configureSentryMemoryOptimization() {
Sentry.init(sentryOptions -> {
sentryOptions.setEnableExternalConfiguration(true);
});
}
}
`

With that we ensured to not automatically configure sentry, but programmatically take the configurations from the yml

Expected Result

With the regular yml configurations and the dependencies used without any programmatically change or any exclusion

Sentry must report errors to the dsn without use all the memory allocated

Actual Result

Sentry was consuming all memory doesn't matter

As is show the reactor instances the memory was increasing

Image Image

But as result it consumes all memory

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions