-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
BlockingSingleSubscriber causes memory leak #3371
Comments
@manoj-mathivanan do you have a pointer to an exception which is accumulating errors? if it is out of the reactor-core then we can do nothing about it |
@OlegDokuka This is the place where the accumulation happens: |
Right, but that should be okay unless propagated exception is a static one. That say it could be a problem of a different library |
@OlegDokuka, you are right. The propagated exception is always the same and the new errors are getting added to the same exception inside suppressed exception list. I create a kafka sender in my bean with wrong configuration
The above kafkaSender is initialized in the bean and is by default lazy loaded when the first message is sent. Now when I try to send a message like below:
The same ex object is thrown everytime I use the above code to send message. In 5 mins, 6K messages are trying to be sent, all the 6K messages end up in error and there are 6K suppressed exceptions in the list and every suppressed exception has completed stacktrace on its own. This memory keeps on growing. In the above example, I have shown you an example of logging the errors. |
related #1872 |
@manoj-mathivanan if we fix that on the reactor level now then it is going to be a breaking change. I'm not sure we can do it now safely. However, we can probably make it into 3.6.x//4.x. I In the meanwhile, I suggest you use |
@OlegDokuka Thanks for picking it up to future release. |
BlockingSingleSubscriber.java accumulates exception in suppressed exception list in the same error object which gets accumulated over time leading to memory leak.
Expected Behavior
New error object should be created and accumulation on old error object should be avoided.
Actual Behavior
Error object is cached internally in the kafka sender which is used as a parent error. Future errors while performing send operations which results in error are accumulated as suppressed exceptions inside the parent error.
Steps to Reproduce
Create a normal kafka sender. Introduce a config exception like below:
This will throw an error while creating a kafka sender -
org.apache.kafka.common.config.ConfigException: delivery.timeout.ms should be equal to or larger than linger.ms + request.timeout.ms
Next, send some messages using the kafka sender.
Possible Solution
Your Environment
reactor-core:3.4.16
200 messages/sec creates 200 exceptions in the suppressed exception list. This keeps growing resulting in memory leak.
netty
, ...): reactor-kafka:1.3.11java -version
): 1.8uname -a
): ubuntu20The text was updated successfully, but these errors were encountered: