| Summary: | BundleContext.installBundle is not atomic | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | David Kemper <djk> | ||||
| Component: | Framework | Assignee: | Thomas Watson <tjwatson> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | bugs.eclipse.org, remy.suen | ||||
| Version: | 3.5.1 | ||||||
| Target Milestone: | 3.6 M6 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
David Kemper
Created attachment 158535 [details]
patch
Here is a patch that allows the configuration setting eclipse.stateSaveDelayInterval=0 to indicate that each persistent framework change is saved without delay.
I also added a shutdown hook to persist the framework data when persistent state changes are delayed.
patch released. There was a bug in the attached patch.
The if (joinWith != null) statement needs brackets because of the added debug trace statments:
if (joinWith != null) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL)
Debug.println("About to join saving thread"); //$NON-NLS-1$
// There should be no deadlock when 'shutdown' is true.
joinWith.join();
if (Debug.DEBUG && Debug.DEBUG_GENERAL)
Debug.println("Joined with saving thread"); //$NON-NLS-1$
}
I released the patch with this fixed. Otherwise NPEs could happen at joinWith.join();
. The shutdown hook should take care of the 95% case, where the user ctrl-c's from invoking the framework, or the JVM shutting down. How is the delay surfaced to the caller? Is "eclipse.stateSaveDelayInterval=0" a framework property? I assume we would then need to make sure all our invocations of Equinox have this property set to guard against JVM crashes. (I realize that for practical considerations you probably don't back your state with a complete, fault-tollerant DB ;-) (In reply to comment #5) > The shutdown hook should take care of the 95% case, where the user ctrl-c's > from invoking the framework, or the JVM shutting down. > > How is the delay surfaced to the caller? Is > > "eclipse.stateSaveDelayInterval=0" > > a framework property? Yes, you can place that in your config.ini if you are using the equinox launcher. If using the standard OSGi FrameworkFactory then you have to set this property as a framework configuration property. > > I assume we would then need to make sure all our invocations of Equinox have > this property set to guard against JVM crashes. Yes, but be aware that it has performance costs since large amounts of writes will occur when installing large sets of bundles. > > (I realize that for practical considerations you probably don't back your state > with a complete, fault-tollerant DB ;-) No but we do safe-guard as much as possible with the org.eclipse.osgi.framework.internal.reliablefile.ReliableFile implementation which does lots of extra work to avoid partial writes during power outages and crashes. |