-
Notifications
You must be signed in to change notification settings - Fork 89
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
Feature/215 async-signal-safe launcher shutdown #753
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #753 +/- ##
==========================================
+ Coverage 90.24% 90.31% +0.06%
==========================================
Files 226 226
Lines 26284 26316 +32
==========================================
+ Hits 23721 23767 +46
+ Misses 2563 2549 -14 ☔ View full report in Codecov by Sentry. |
Here is an interesting program hang: https://github.com/apache/celix/actions/runs/9478654947/job/26115518903
The issue should have been fixed by d384c86. Note that There are still room for further improvements: ideally we shall not permit events (neither generic or scheduled) to be posted to an inactive dispatcher. But I will leave it for a future PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpick remarks, but LGTM.
libuv is very interesting and seems to provide a lot of the functionality we use and have implemented ourselves, including a single-thread event loop, shutdown procedure, as well as cross-platform polling, threading, locking, filesystem abstractions, etc. Since it uses an MIT license and does not have dependencies, it could be suitable for Apache Celix. This could help in supporting more platforms and even be a step towards supporting Windows (we had some support for loading DLL libraries in the past). In the short term, this may be a step too far, but it's at least worth a discussion. |
Specific to this PR:
|
This PR fixes a long-standing issue #215 by implementing async-signal-safe launcher shutdown.
Without making our event loop more powerful (like libuv), I think setting a flag to be checked by a periodic scheduled event callback is the best we can do. So here it is.
This PR also makes
celix_launcher_triggerStop
safer. Previously a bundle may initiate a framework shutdown, which will causecelix_framework_waitForStop
to return without noticing the launcher. In that case,celix_launcher_triggerStop
might reference a to-be-destroyed framework instance to wreck havoc. Now we prevent it from happening withg_launcher.lock
.