Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319380

Summary: Back to Back provisioning operations can lead to a closed backup store
Product: [Eclipse Project] Equinox Reporter: Ian Bull <irbull>
Component: p2Assignee: Ian Bull <irbull>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pascal, simon_kaegi
Version: unspecifiedFlags: simon_kaegi: review+
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix v1 none

Description Ian Bull CLA 2010-07-09 09:02:11 EDT
When doing two provisioning operations in a row, I get the following exception (on the second operation):

org.eclipse.equinox.internal.p2.touchpoint.natives.ClosedBackupStoreException: Can not perform restore on closed backup store
	at org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore.restore(BackupStore.java:406)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.LazyBackupStore.restore(LazyBackupStore.java:53)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.NativeTouchpoint.rollback(NativeTouchpoint.java:108)
	at org.eclipse.equinox.internal.p2.engine.EngineSession.rollback(EngineSession.java:194)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:82)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:44)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:48)
	
After some digging, I know what's going on.

1. The first operation creates a backup store and then eventually discards it (in the commit)
2. However, the backup store is cached in a weak hash map (static) in NativeTouchpoint
3. The next operation needs to use the store, and it finds the cached one
4. It grabs it, and tries to use the store
5. Boom... already closed.

I think we need to clear the backup store cache during the commit.

I'll put a patch together.
Comment 1 Ian Bull CLA 2010-07-09 09:58:23 EDT
Created attachment 173862 [details]
fix v1

This clears the profile state stored in the native touchpoint during the commit.
Comment 2 Ian Bull CLA 2010-07-11 09:44:24 EDT
I've released this to head. What do you think of this for 3.6.1?  It's pretty safe since all we're doing is proactively clearing a weak hash map when we're done with it.