Comments (5)
The generated glue held inside that ClassValue
should be unloaded when the host class (ie. the application class) is unloaded, which is when its class-loader is able to be unloaded. I can double-check with a simple test app, but it sounds like something else is keeping your child class-loaders alive, which then keeps those generated fast-classes alive.
Is your code publicly available?
Note if you don't need bytecode generation then you can turn it off with:
-Dguice_bytecode_gen_option=DISABLED
but that would also mean you couldn't do method interception.
from guice.
Sorry, the code is not public.
The only strong references I am seeing are from Guice. But, maybe once the weak/soft references are cleaned, since Guice's references will be the only ones, they will be cleaned as well? I could check that.
In which scenario would we be using method interception?
We only have a bunch of Modules either binding Interfaces to Implementations (in the configure() method) or defining a @ Provides method.
As for injection, we do field and constructor injection with @ Inject
from guice.
Part of the problem with unloading is that a lot is held back until the class-loader itself becomes unloadable, which does make it hard to debug - we do have tests in the codebase to verify proxy unloading, which uses a similar mechanism, and those are currently passing.
Regarding method interception - that's if you are using the bindInterceptor
method: https://github.com/google/guice/wiki/AOP
If you're not using that then try adding -Dguice_bytecode_gen_option=DISABLED
as a JVM option to see if it helps.
from guice.
Awesome! I will try to figure out if there is anything else preventing the Class Loader to be unloaded.
In the meantime, I will try using that flag, I don't think I require method interception. Maybe I can isolate the root problem better.
Thanks for the quick response!
from guice.
Following up on this
Using -Dguice_bytecode_gen_option=DISABLED
definitely worked. I no longer see those paths to GC roots. What's more, the service seems to be working just fine, so I guess we can execute without method interception.
However, based on the information you provided, even if using bytecode generation, those paths should be cleared. So, I will keep searching for another cause for this issue. I already have a lead with a lib we are using.
Closing this ticket for now.
Thanks a lot for the help!
from guice.
Related Issues (20)
- InternalProvisionException.errorInUserCode discards important context about user errors HOT 1
- Annotations @Provides and @Singleton do not work together HOT 2
- HiddenClassDefiner incorrectly assumes Unsafe.staticFieldBase(Field) returns a real Object HOT 8
- Bob Lee,God bless You
- Feature Request: MicroProfile-config integration: Allow injecting annotations with jakarta.inject.Qualifier HOT 12
- where are the installation instructions? HOT 4
- java.lang.ClassCastException: class com.google.inject.servlet.GuiceFilter cannot be cast to class jakarta.servlet.Filter (com.google.inject.servlet.GuiceFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @e383572; jakarta.servlet.Filter is in unnamed module of loader java.net.URLClassLoader @2ef1e4fa) HOT 1
- Changed behaviour in Guice 7 HOT 3
- Struts 6.x.x not working with Guice HOT 9
- Performance Issue in getJustInTimeBinding Method HOT 1
- Misleading exception message for nested Guice injector failure
- 8 Flaky tests in the module extensions/throwingproviders
- Request/Question: Provide non-jarjar'd builds
- Guice AOP is not compatible with Kotlin Coroutines HOT 2
- Enable to define a custom "@Inject" marker (ie add some extension point for reflection doing getAnnotation/isAnnotationPresent on this marker)
- Implement a functionality similar to Spring Boot’s fully automatic configuration dependency injection
- Replace Guava with standard Java (where possible) HOT 3
- Vulnerabilities referenced in version 7
- GCP OAuth2 auth method failed through Java SDK when trying to build a Docker image in local
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guice.