Custom handler for OOM error #2917
Labels
for/stackoverflow
Questions are best asked on SO or Gitter
for/user-attention
This issue needs user attention (feedback, rework, etc...)
status/invalid
We don't feel this issue is valid, or the root cause was found outside of Reactor
How can I handle "java.lang.OutOfMemoryError: Java heap space" in reactor?(https://stackoverflow.com/questions/71016578/how-can-i-handle-java-lang-outofmemoryerror-java-heap-space-in-reactor)
I implemented my simple rest endpoint using reactor and Webflux: https://github.com/typik89/webfluxMemoryRetroProject.
As a result of HTTP GET requests It requests data from a database and creates a file with a size of about 70MB. So If I run it with -xmx100m, I have only an error in logs:
2022-02-07 12:25:06.135 ERROR 10288 --- [actor-tcp-nio-1] r.n.channel.ChannelOperationsHandler : [7edd71ea, L:/127.0.0.1:58918 - R:localhost/127.0.0.1:5432] Error was received while reading the incoming data. The connection will be closed. java.lang.OutOfMemoryError: Java heap space .... 2022-02-07 12:25:06.141 ERROR 10288 --- [actor-tcp-nio-1] i.r.p.client.ReactorNettyClient : Connection Error reactor.netty.ReactorNetty$InternalNettyException: java.lang.OutOfMemoryError: Java heap space
This error isn't handled and an HTTP client request hangs. Is this expected behavior? how can I handle this exception? I've tried onErrorResume and Hooks.onOperatorError but I couldn't intercept this type of exception. It seems unlogical for me that the application keeps working and I can't intercept and handle such errors
The text was updated successfully, but these errors were encountered: