pnoltes commented on PR #627: URL: https://github.com/apache/celix/pull/627#issuecomment-2081638679
Thanks for the update. > > **POC approach using Weak and Arc** In the POC I think this was tried to achieve by using `std::sync::Weak` pointers. However I am not sure if this is entirely sound. For example when building the Servicetracker we upgrade the `Weak` to an `Arc`. What happens if this is done in another thread and immediately after upgrading the `Weak` and before actually tracking the service the bundle gets stopped and destroyed. I think we would have a use after free situation here. You are correct, the usage of `Weak` mimics what is done in C++. Note that in C++ de bundle deactivates waits until all upgraded `Weak` (`std::weak_ptr`) to `Arc` (`std::shared_ptr`) are out of scope and prints an error when this takes too long. But I agree, ideally this is improved using Rust lifecycles. And great to see, and impressive, that you already made some progress with Rust lifecycles and Apache Celix. The coming week I will not have the time have a look at the code and give feedback, but when I have to time I will pick this up. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
