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
(Reproducable) - Memory leak and sockets leak issue - LEAK: ByteBuf.release() & OutOfDirectMemoryError #664
Comments
Have you looked at these filters? https://github.com/spring-cloud/spring-cloud-gateway/tree/master/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite Remember: once you start reading request and response bodies, the gateway is now constrained by all memory needed for concurrent requests. |
This comment has been minimized.
This comment has been minimized.
Please don't comment on unrelated issues |
@spencergibb - No, this is related. As suggested in your previous comment, using this same sample application, I am trying to verify if using ModifyResponseBody filters results in Memory leak and sockets leak issue before we rewrite our production code. I am stuck with the configurations that the ModifyResponseBody filter is expecting so looking for your advice. Please can you help? |
You didn't say that. All you asked about was configuration. Which isn't possible in yaml yet |
Thanks for getting back to me @spencergibb . Is it possible to use |
@spencergibb - Thanks a lot for pointing me to the ModifyResponseBodyGatewayFilterFilter. As I was not able to add the configuration required for ModifyResponseBodyFilter in yml, I created my own filter with the logic written in ModifyResponseBodyGatewayFilterFilter and executed previous test which ran successfully and didn't see the memory leak. We will do some more tests before rewriting our production code. One last question if you feel this is relevant - We would like to use gateway version |
As suggested earlier, alternate approach to read response body seems solved the memory leak issue. Sample code can be referenced here -
|
We created a gateway server running with few filters that are related to response, request decorators and readers along with other header modifier filters. The filters are mixer of pre, post, gateway and global in nature. As soon as we deployed gateway server to production, we started experiencing memory leaks, sockets leaks issues. We tried various tuning options such as increasing memory, tuning open files, removing micro-meters, moving to M1/snapshot versions and more but nothing helped hence we had to pull out gateway server from production after a month of trying.
I have managed to re-create the problem in local/dev environment by creating a simple and sample gateway server. The sample application has just two gateway filters, one reads the response and other uses response decorator. To re-produce the issue, I run the gateway server as a standalone spring boot application. And I was generating load using
jemeter
- 500 requests ramped up in 60 secs and continued same the load for 30 iterations.I have used below stable versions when building the sample application -
Issue can be replicable on all the below scenarios
**No memory leaks found. Server was running over 1 hours without any issues **
Sample application can be found at https://github.com/nilavalagansugumaran/gateway-netty-memory-leak-issues along with instructions.
@spencergibb & @violetagg - Please can you help in getting the issue resolved with ResponseDecorators and ResponseWriters or any alternatives that we can try?
Logs and screenshots
(Full logs and heap utilisation screenshot can be found at https://github.com/nilavalagansugumaran/gateway-netty-memory-leak-issues/tree/master/logs )
Screenshots
The text was updated successfully, but these errors were encountered: