Semyon Kirekov
Semyon Kirekov

Reputation: 1440

Spring Webflux: Schedulers.boundedElastic grows infinetely

I'm monitoring my Spring WebFlux app with VisualVM and I'm noticing a strange thing.

The boundedElastic threads are keeps increasing.

bounded elastic threads

The thing is that I don't use boundedElastic scheduler in my app app manually.

After debugging I found this

boundedElastic method stacktract

Seems that InMemoryWebSessionStore requests the Schedulers.boundedElastic. The thing is that this method does not require any authorization though I have Spring Security in the dependencies.

How can I disable this behavior? I don't want my app to grow some thread pool size infinitely. Especially when those threads aren't even used.

P.S. Maybe this issue comes from the fact that I inject ServerWebExchange as the controller method parameter. But I need it to retrieve the request's cookies and headers

Upvotes: 1

Views: 1607

Answers (1)

Semyon Kirekov
Semyon Kirekov

Reputation: 1440

Ok, I got it. WebSessionManager is auto-configured. I have to declare my own no-op implementation. Here is the similar question.

Upvotes: 1

Related Questions