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

Bug 72653

Summary: [osgi] Application update through update site causes OSGI error on restart
Product: [Eclipse Project] Platform Reporter: Todd E. Williams <todd>
Component: RuntimeAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: birsan, jeffmcaffer, tjwatson
Version: 3.0   
Target Milestone: 3.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix to PackageAdmin none

Description Todd E. Williams CLA 2004-08-25 20:44:20 EDT
This problem was originally posted as a followup to Bug #70783, but Dorian
recommended that it be opened as a separate bug against Platform UI instead.  So
here it is.

The basic problem is that updating an application through the update site seems
to work correctly, but on restart the error log has several messages and the
product extension is now unusable.  However, restarting Eclipse with -clean
resolves all issues and the application functions correctly.  Here are the
entries from the log, followed by the steps to recreate the problem.

Log caused by restart after product update:
!SESSION Aug 25, 2004 20:18:15.463 --------------------------------------------
-
eclipse.buildId=I200406240800
java.version=1.4.2_03
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US

!ENTRY System Bundle 0 0 Aug 25, 2004 20:18:15.463
!MESSAGE FrameworkEvent.ERROR
!STACK 0
org.osgi.framework.BundleException: PackageAdmin.refreshPackages failed to 
complete
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta
(PackageAdminImpl.java:518)
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.refreshPackages
(PackageAdminImpl.java:352)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run
(PackageAdminImpl.java:321)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.osgi.framework.BundleException: Internal Error in the OSGi 
framework. Please report this problem.
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.deleteRemovalPending
(PackageAdminImpl.java:157)
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta
(PackageAdminImpl.java:454)
	... 3 more
Root exception:
org.osgi.framework.BundleException: Internal Error in the OSGi framework. 
Please report this problem.
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.deleteRemovalPending
(PackageAdminImpl.java:157)
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.processDelta
(PackageAdminImpl.java:454)
	at 
org.eclipse.osgi.framework.internal.core.PackageAdminImpl.refreshPackages
(PackageAdminImpl.java:352)
	at org.eclipse.osgi.framework.internal.core.PackageAdminImpl$1.run
(PackageAdminImpl.java:321)
	at java.lang.Thread.run(Unknown Source)

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.617
!MESSAGE Unable to find Action Set: com.genuitec.myeclipse.actions.deploytools

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.627
!MESSAGE Unable to find Action Set: com.genuitec.myeclipse.actions

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.627
!MESSAGE Unable to find Action Set: 
com.genuitec.myeclipse.actions.hibernatetools

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.637
!MESSAGE Unable to find Action Set: com.genuitec.myeclipse.actions.webtools

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.637
!MESSAGE Unable to find Action Set: com.genuitec.myeclipse.actions.jsftools

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:18.637
!MESSAGE Unable to find Action Set: com.genuitec.myeclipse.actions.strutstools

!ENTRY org.eclipse.ui 4 4 Aug 25, 2004 20:18:43.32
!MESSAGE Category com.genuitec.eclipse.views.myEclipseCategory not found for 
view com.genuitec.eclipse.ui.HTMLView.  This view added to 'Other' category.


Please note that is is Dorians log with a later build of Eclipse 3.0.  However,
the same error exists in the 3.0 release of 6/25.

Here are the steps to reproduce the problem.

1) Install a clean version of Eclipse 3.0
2) Download the MyEclipse 3.8.0 manual installation available here:
http://www.myeclipseide.com/products/eworkbench/eclipse-bug70783-test/myeclipse_030800.zip
3) Unzip the archive somewhere outside your Eclipse installation. 
4) Install it as a product extension through Help > Manage Configuration...
5) Restart
6) Open Help > About Eclipse and notice the five MyEclipse features are installed.
7) Open the MyEclipse Perspective and the Error Log view
8) Exit the workbench
9) Update to version 3.8.1 by adding a new update site that points to:
http://www.myeclipseide.com/products/eworkbench/updates-3.8.0to3.8.1
10) Allow the workbench to restart
11) Upon restart you'll get several errors about missing action sets and the
need to reset the perspective.
12) The log will have several errors in it about missing functionality and most
of the features are now unavailable even though 3.8.1 was only a bug-fix update.
13) Clear the log file in the Error Log view and exit Eclipse
14) Restart with the -clean option and notice that now MyEclipse 3.8.1 starts
without error and all functionality is now available.

Naturally, the lare number of errors in the log and multiple perspective reset
dialogs do not enhance the end user experience.  The broken functionality after
the update only exacerbates the issue.  Again, all fixed with a -clean start. 
Hope that helps.  Please let me know if you need any more information.
Comment 1 Dorian Birsan CLA 2004-08-25 22:34:51 EDT
The multiple prompts to the user to accept/deny perspective resets is likely 
caused by the old plugins being uninstalled and the newer version being 
installed. This can be solved with a yes/no/always type of dialog, etc.

As far as I can tell, this does not appear to be an update bug, but rather a 
side effect of updating manifested in the UI.
Comment 2 Todd E. Williams CLA 2004-08-25 23:25:25 EDT
I'm not concerned about the dialogs asking to reset the perspective.  What
bothers me is that after all of that, most of the actions are disabled, as shown
in the log.  Basically, the software is broken without a -clean restart.
Comment 3 Dorian Birsan CLA 2004-08-26 00:16:38 EDT
Moving to runtime for investigation (as per .log's entry:
Caused by: org.osgi.framework.BundleException: Internal Error in the OSGi 
framework. Please report this problem.)
Comment 4 Pascal Rapicault CLA 2004-08-26 09:45:46 EDT
This should be investigated for 3.0.1.
CC'ing Tom
Comment 5 Thomas Watson CLA 2004-08-26 11:29:41 EDT
Do you have to use the -clean option.  When I restart eclipse a second time 
without the -clean option it looks like everything comes up fine.

I'm tracking down a bug in PackageAdmin.refreshPackages() now...
Comment 6 Thomas Watson CLA 2004-08-26 12:39:40 EDT
Created attachment 14198 [details]
Proposed fix to PackageAdmin

There is a bug in PackageAdmin when a fragment gets uninstalled.  In this case
the host bundle's classloader was getting pinned for removal pending which is
needed because a fragment got uninstalled so the content of the host changed. 
The bug is in the processing of the graph of dependent bundles to refresh.  

When processing the removal pending bundles the depenedents for the removal
pendings are not always added to the refresh graph.  In this case the host was
jface.text because the myeclipse product has a fragment to jface.text.	Since
the dependents of jface.text were not added to the refresh graph this caused
refreshPackages to fail when it tried to remove the classloader of the old
jface.text host bundle.
Comment 7 Todd E. Williams CLA 2004-08-26 12:41:40 EDT
Thomas, -clean is exactly the issue.  You *have* to use the -clean option on the
restart.  However, telling users this is exceedingly problematic as they
immediately think the update broke their installation and become frantic.  

I truly believe that when the configuration is changed, the restart should
*always* be a clean restart to avoid this and any future problems.  Logically,
the configuration has been changed, so the cached configuration is trully
invalid, so the cached configuration should be dumped.  
Comment 8 Thomas Watson CLA 2004-08-26 13:55:21 EDT
OK, I understand now.  I thought you meant you had to run with the -clean 
option when you launched eclipse again after the original errors occurred to 
get it to work.  I had found that after the errors occurred I could simple 
relaunch eclipse again (without the -clean option) and everything would be 
fine.

Relauncher eclipse with -clean everytime update performs an 
install/update/uninstall would cause some other problems.  First of all, it 
would prohibit us from supporting installs/updates/uninstalls without 
restarting eclipse (which is a goal we want to accomplish but did not fully 
make it for 3.0).  Also, it would prohibit any other management agent besides 
update from installing and managing other bundles installed in the Framework.  
The -clean option causes all bundles to be uninstalled and then update 
installs all the plugins on restart, but any other bundles that were installed 
by another management agent will have been lost.

The reason the problem outlined in this report occurred is because of a bug in 
PackageAdmin.  We should fix the bug in PackageAdmin and keep moving forward 
in making eclipse updatable without restarts.  I attached a patch that fixes 
this bug and tested out with your scenario and everything works now.
Comment 9 Todd E. Williams CLA 2004-08-26 14:16:34 EDT
Thomas, that was a very well articulated explaination.  Thanks for the quick
turnaround on the fix and for making it available for 3.0.1.
Comment 10 Thomas Watson CLA 2004-08-26 15:15:21 EDT
Well I have not actually made it available for 3.0.1 yet ;-)

Need to get a code review.  Jeff, could you review the patch and get it 
approved to include in 3.0.1?  
Comment 11 Jeff McAffer CLA 2004-08-30 09:46:56 EDT
changes look good to me.  
Comment 12 Pascal Rapicault CLA 2004-08-30 10:04:55 EDT
looks good to me too.
Comment 13 Pascal Rapicault CLA 2004-08-30 10:08:23 EDT
At the very beginning of this method, in the refresh==null branch why don't we
have the same code pattern?
Comment 14 Thomas Watson CLA 2004-08-30 10:34:17 EDT
Looks like this code could be cleaned up a bit.  We are doing some additional 
work in the beginning of this method that will be taken care of later on when 
we complete the graph in the do while loop.  When refresh == null we really 
just want to prime the gragh with the removal pending bundles, the else 
statements really are not even needed because fragments are take care of in 
the do while loop later.

We should consider cleaning this up for 3.1.
Comment 15 Thomas Watson CLA 2004-08-30 10:57:50 EDT
The patch has been checked into 3.0.1 and HEAD.  See bug 72877 to track 
additional clean up of this code for 3.1 release.
Comment 16 Jim des Rivieres CLA 2004-08-30 11:41:19 EDT
Thomas, Please mark as fixed before 3.0.1 RC1.
Comment 17 Thomas Watson CLA 2004-08-30 12:11:58 EDT
The fix will be included in 3.0.1 RC1.