-
Notifications
You must be signed in to change notification settings - Fork 273
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
Leak on parceler compiler (org.parceler.ParcelAnnotationProcessor$$Bootstrap) #378
Comments
Hmm, this is certainly concerning. Could you help me reproduce @doniwinata0309 ? |
This is sample to repro the leak:
I also attached the result of leak on the branch https://github.com/doniwinata0309/build-perf-test/tree/test/parceler |
The REPOSITORY object being referenced on the tree view: |
Hmm, maybe im out of touch with gradle these days, but I cant get
Is |
yes it is from |
Ok, I'm up and running. I haven't been able to pinpoint the If you perform a GC after the build is memory cleared up back to normal? The point of the |
is it because scoped with @bootstrap causing ParcelAnotationProcessor cannot be GC'd. ParcelAnnnotationProcessor itself become really huge because it contains and refer to Bootstraps which also hold REPOSITORY object. Does the Bootstraps will getting huge as more class using @parcel ? wondering if somehow we can destroy the bootstraps/REPOSITORY object, so even though parcelAnotation cannot be GC'd at least it only leaking very less amount of memory. |
This should be easy to fix then.. just need to remove the cache located here. |
it should be worth if it safe to remove that field. I would love to try that, can you give me advice how to try that on some branches or patch ? google/dagger@2902519 |
This should do the trick: https://github.com/johncarl81/transfuse/tree/remove_bootstraps_repo (johncarl81/transfuse@a5ec966). To test, you build Transfuse and install it into your local maven repo. Next, you'll need to change this in Parceler: to |
Thanks @johncarl81 , i already build the maven and tried it on our project. The leak has gone and daemon not stuck anymore, it certainly giving huge impact into our full build. |
Awesome! Thanks for testing it out. We use a similar technique in the |
|
I see, I think it is fine to our apps with current behaviour on Parcels class. As it not load much memory and can mitigate runtime overhead as you said. |
Ok, ill look at making a release shortly with this update. |
Hi @johncarl81 any ETA for the new release with this fix ? Thanks |
Hi @johncarl81, I hope you are doing well. Any chance this Bugfix will be deployed soon ? Thanks |
Shoot, I've been meaning to do a release, just been backed up with other priorities. Keep bugging me if I don't get to it. |
Understood, thank you for letting me know your situation. I will remind you again in weeks :) |
Released to maven central under 1.1.13. |
Thank you for the release and fix this issue, greatly appreciate your time. |
@doniwinata0309, just to be doubly sure, is this release working 100% for you now? |
I did benchmark today at my CI, so far i did not see any significant improvement on build speed as i expected. But from visual VM using very less memory footprint compared to previous one. Does the change johncarl81/transfuse@a5ec966 possibly will causing more cpu usage because it removing static classes that hold generated code ? I will give more info after checking the cpu usage on this release comparing to the previous one. |
Perhaps. It will have to stand up the environment fresh for each run of the processor, but that's what we want here. Curious to see your results. |
Hi @johncarl81 , i analysed parceler 1.1.12 and 1.1.13 to our build in this doc: |
Good stuff @doniwinata0309. Is this analyzed against https://github.com/doniwinata0309/build-perf-test/tree/test/parceler ? |
No, it is the test result from my real project actually 😄 |
I think we solved the immediate issue, but I am still curious about other touchups we could make, also in this memory leak you're referring to. If this issue is solved, open another issue if anything else comes up. Sound good? And thanks again for bringing this to our attention! |
Sure, i will let you know if i find some similar problem again, so far it looks good on the newest Android Gradle Plugin. I really appreciate your time on fixing this issue. Thanks for your help 🙏 🙏 |
Hi,
Our build got memory leak on
org.parceler.ParcelAnnotationProcessor$$Bootstrap
. It causing stuck on our build when JVM (daemon) memory full, and cannot perform any GC. Then the heap dump showing leak and dominator object fromorg.parceler.ParcelAnnotationProcessor$$Bootstrap
.It takes around 50 % of our heap size (around 2GB).
The image below shows the dominator and leak object when compiling our project.
This is the screenshot of our main daemon when it got full because of parceler leak. At this point the build will hanging and won't complete (not even causing OOM).
It seems coming from this file.
https://github.com/johncarl81/parceler/blob/master/parceler/src/main/java/org/parceler/ParcelAnnotationProcessor.java#L4
Do you have clue what might be wrong ? We suspect transfuse as DI manager creating static variable that will contains reference to that class. But i am not really sure which part causing this issue.
We have like 50+ modules implement parceler_api (annotation processor), and using lot of
@Parcel
class.Let me know if you have additional information, Thanks.
The text was updated successfully, but these errors were encountered: