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
Classloader leak with Throwable in static fields #1872
Labels
type/enhancement
A general enhancement
Milestone
Comments
reference of a similar issue in the JDK: https://bugs.openjdk.java.net/browse/JDK-8146961 |
Thanks for reporting this! IntelliJ Structural Search reveals a total of 4 static fields that have a type that extends
source search template: |
simonbasle
added a commit
that referenced
this issue
Sep 2, 2019
When the stacktrace of a `Throwable` is filled, the JVM transparently adds a `backtrace` field that references classes from the stacktrace. In multi-classloader environments, this can lead to leaks when the `Throwable` (of subclass of) is static. This commit changes the few occurrences of static exceptions in Reactor so that they each use a variant that doesn't fill the stack trace. TERMINATED uses a general-purpose StaticThrowable which means that it can reference the super constructor with boolean flags disabling exception suppression and stack trace filling, without having to override the fillInStackTrace method. Reviewed-in: #1876
simonbasle
added a commit
that referenced
this issue
Sep 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In dynamic classloader environments, the use of Throwable in static fields may cause a classloader leak in the backtrace field. This field is set in runtime at native code with an array that are instances of Class. This may cause a Classloader which should be disposed to be retained.
In other projects, an error without a writable stacktrace was used for this cases.
I've opened a PR for this:
#1871
Let me know.
Thanks!
The text was updated successfully, but these errors were encountered: