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

Static variables in ELUtils cause memory leaks and leaks of resolver cache between applications #5461

Closed
OndroMih opened this issue Jul 26, 2024 · 1 comment
Milestone

Comments

@OndroMih
Copy link
Contributor

Describe the bug

When Mojarra is used in an application server, its classes are loaded by the app server's classloader and are shared by all deployed applications. This can lead to at least to serious issues:

  • Some of the static resolvers store references to the application classloader with soft references. If the application is undeployed from the server, these references can hang in the resolver cache for a long time, even until the heap is full. They don't generate OOM but may block the memory up to the heap size, even though the classloader is not used anymore. Details in this issue: BeanELResolver cache causes Class Loader leaks in app servers jakartaee/expression-language#214
  • Since the resolvers are global and shared by all applications, different applications might clash, and one application could see data from another application. This is purely hypothetical, I didn't find any resolver that would allow that but still, sharing a global variable between multiple applications is not a good practice and is potentially risky

To Reproduce

The memory leak can be reproduced as discussed in jakartaee/expression-language#214

Expected behavior

Each application that is deployed on an application server uses its own set of resolvers. Doesn't share them with other applications.

OndroMih added a commit to OmniFish-EE/mojarra that referenced this issue Jul 26, 2024
…es (eclipse-ee4j#5461)

This avoids sharing resolvers between multiple applications on the classpath
and also avoids memory leaks in application servers after an application and its classloaders are undeploed.
OndroMih added a commit to OmniFish-EE/mojarra that referenced this issue Jul 26, 2024
…es (eclipse-ee4j#5461)

This avoids sharing resolvers between multiple applications on the classpath
and also avoids memory leaks in application servers after an application and its classloaders are undeploed.
@OndroMih
Copy link
Contributor Author

OndroMih commented Jul 26, 2024

A fix for the 4.1 version is here: #5462
Should be also backported to 4.0 so that Jakarta EE 10 app servers like GlassFish can include the fix.

I cannot build the current master branch. I assume it's not buildable because it depends on a new snapshot Faces version. So I didn't raise the PR for the master branch.

OndroMih added a commit to OmniFish-EE/mojarra that referenced this issue Aug 4, 2024
…es (eclipse-ee4j#5461)

This avoids sharing resolvers between multiple applications on the classpath
and also avoids memory leaks in application servers after an application and its classloaders are undeployed.
@BalusC BalusC added this to the 4.0.8 milestone Sep 1, 2024
@BalusC BalusC closed this as completed Sep 1, 2024
BalusC added a commit that referenced this issue Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants