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 leak in Undertow (2.15.1) #2607
Comments
I manage sse connections as below (simplified):
Probably you know better way. but this works without issue on 2.13.0) |
Hello, I am still using version 2.13.0 as it has no memory leaks. Should I try version 3.x, or has there been no change related to my problem? |
Hi, nothing changed in Jooby and I couldn't find any bug related in Undertow. Jooby 3.x has a new version of undertow you can try that or in 2.x you can override the undertow dependencies and try that too. |
Thanks, as soon as 3.0.0.M3 with Kotlin 1.8.0 appears, I will try the new version) |
jooby 2.13.0 was released with undertow 2.2.14.Final while jooby 2.16.1 (latest 2.x) uses: undertow 2.2.19.Final and xnio 3.8.7.Final In your project try this:
<!-- https://mvnrepository.com/artifact/io.undertow/undertow-core -->
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>2.2.14.Final</version>
</dependency>
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-utow</artifactId>
<version>2.16.1</version>
<exclusions>
<!-- https://mvnrepository.com/artifact/org.jboss.xnio/xnio-api -->
<exclusion>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-api</artifactId>
</exclusion>
</exclusions>
</dependency> |
I tried it first with the configuration you suggested and found no memory leaks. Then removed all the exclusions and switched completely to version 2.16.1 and in 64 hours of use there is no sign of any memory leaks. UPD: Can you please take a look at #2462 |
Unfortuanetely, the issue has not been fixed. I've updated the Jooby version in the output artifact and unfortunately the problem is relevant to version 2.16.1.
In the pictures below you can see that memory usage is constantly increasing, although on 2.13.0 memory usage was in the same range and did not increase. I captured two heap snapshot with 10 min difference and here the result of dump comparison: I'll take your recommendation (#2607 (comment)) and check for memory leaks with the correct version of the undertow and xnio dependencies in the output artifact. |
So, here are the results using the dependency versions you specified in #2607 (comment):
(Jooby 2.16.1) |
I was curious to find out in which version the memory leak appeared in order to localise the problem.
Jooby 2.15.0 - leak:
Note that dependencies have not changed. I'm not very good at using MAT, but perhaps this will give you an idea: Option "Merge shortest paths to GC Roots" on io.undertow.server.protocol.http.HttpOpenListener$1 objects on 2.14.2 heap dump gave the following results: Output for 2.15.0: Also io.undertow.server.HttpServerExchange objects: Huge number of references in 2.15.0 from sun.nio.ch.WEPollSelectorImpl, and the number keeps increasing. |
Hello.
For a long time I have been trying to detect a memory leak in my program, but after tests it turns out that the leak is not in my code. I built the project with Jooby 2.13.0 and Kotlin 1.4.32 - no leaks. Then I built the project with 2.15.1 and Kotlin 1.6 without any code changes and found memory leaks again.
I'm attaching a screenshot of heap analysis in MAT, maybe I should clarify some details from MAT (I haven't dealt with memory leaks before) - I'd be happy to share it, or maybe I should report it to Undertow?
I would like to note that the leak occurs in project with active SSE usage, in my other projects (without SSE) I haven't encountered OOM even on 2.15.1 version, but I haven't investigated their memory consumption carefully either.
The text was updated successfully, but these errors were encountered: