-
-
Notifications
You must be signed in to change notification settings - Fork 71
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 AbstractConnectionBase#importedObjects #261
Comments
I checked the usage of The purpose of this This ensures that if querying for the same object (using the object path) on DBus you will receive the same object instead of creating a new one. The I'm not sure that using a It may introduce other problems I'm not aware of of yet. |
I use dbus-java to manipulate systemd units using https://github.com/thjomnx/java-systemd (https://www.freedesktop.org/wiki/Software/systemd/dbus/). It uses single connection to work with systemd via dbus.
Is connection supposed to be reopened periodically to cleanup unnecessary objects? |
There is nothing to clean up once a DBus connection is closed. At that time everything belonging to that connection is obsolete. This includes the I would like to understand what your application is doing so this behavior becomes an issue.
It is impossible to know if an remote object is still valid from the library point of view. You have to do any sort of 'action' with that object and then only you know that it is broken - the library internals are not aware of that. |
Communicating with systemd (starting systemd-units) via single connection for entire lifetime of application. Because of that it may keep connection for long time (basically until we need to update the application). |
… objects already support weak references)
I updated the code so you can now use However, the default behavior of using regular (hard) references is unchanged. I may change that in the future, but I'm still unaware of the possible side effects. Nevertheless if you set the flag using the builder your will not be affected by future changes of the default. |
Hello!
We used 2019 year forked version of this library and now we are assessing the possibility to upgrade. We encountered that there is a memory leak in
AbstractConnectionBase.importedObjects
because objects is only added/queries to this map, but never removed. I suppose current version is affected by this issue.Our fix included change
ConcurrentHashMap
toCollections.synchronizedMap(new WeakHashMap())
, but maybe it not the best option.P.s. thank you for great library)
The text was updated successfully, but these errors were encountered: