Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory & connection leak in reactor-netty instrumentation #4862

Closed
raptium opened this issue Dec 10, 2021 · 4 comments · Fixed by #4867
Closed

Memory & connection leak in reactor-netty instrumentation #4862

raptium opened this issue Dec 10, 2021 · 4 comments · Fixed by #4867
Labels
bug Something isn't working

Comments

@raptium
Copy link

raptium commented Dec 10, 2021

Describe the bug
When using WebClient in Spring WebFlux, a SimpleDequePool is created on every HTTP request and never gets disposed.

Steps to reproduce

  1. Included spring-boot-starter-webflux as a dependency
  2. Create a org.springframework.web.reactive.function.client.WebClient
  3. Use this client to send some HTTP requests

What did you expect to see?

  1. Sending requests with one WebClient should create only one connection pool and reuse connection if possible.

What did you see instead?

  1. Lots of SimpleDequePool live in heap and lots of TCP connections are established. None of these will get disposed after GC.
  2. Server gets OOM or reaches limit of num of FD eventually.

What version are you using?
1.9.1

Environment
Compiler: openjdk 1.8.0_312
OS: macOS 12.0.1

Additional context

  • PooledConnectionProvider use PooledConnectionProvider.PoolKey as key for its internal channelPools (ConcurrentHashMap).
  • Hashcode of PooledConnectionProvider.PoolKey is computed with pipelineKey and other fields.
  • pipelineKey is assigned with TransportConfig.channelHash()
  • channelHash() is computed with observer and other fields.
  • observer is a different instance of HttpResponseReceiverInstrumenter.EndOperation on each HTTP request and it may cause PooledConnectionProvider to create a new pool every time
@sh777
Copy link

sh777 commented Jan 6, 2022

Hi, this is quite a critical issue in current release. I wonder when will we be able to release the fix?

@trask
Copy link
Member

trask commented Jan 6, 2022

1.10.0 is targeted for end of next week. This issue does meet our patch release policy if you need it sooner.

@sh777
Copy link

sh777 commented Jan 7, 2022

Hi @trask, thanks a lot! We indeed need it urgently. We really appreciate if we could have a patch for it.

@trask
Copy link
Member

trask commented Jan 7, 2022

@sh777 1.9.2 is released with this fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants