Bug 327471 - java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source)
Summary: java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 203725 348339 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-11 12:32 EDT by Missing name CLA
Modified: 2021-08-18 05:33 EDT (History)
6 users (show)

See Also:
jarthana: review+


Attachments
Proposed patch (5.19 KB, patch)
2010-12-16 06:43 EST, Satyam Kandula CLA
no flags Details | Diff
Patch (5.73 KB, patch)
2010-12-20 06:39 EST, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2010-10-11 12:32:29 EDT
Build Identifier: Build id: 20090619-0625

Using JRE1.5.0_22, can recreate an EOFException when I activate Eclipse with a clear workspace, create a General Project, create a new file, enter text in the new file, exit eclipse, activate Eclipse without a clear workspace, check .log file and get the EOF Exception.
This also occurs with Eclipse 1.6 and Java 1.6.

java.io.EOFException
                at java.io.DataInputStream.readInt(Unknown Source)
                at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadInt(JavaModelManager.java:3275)
                at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadVariables(JavaModelManager.java:3341)
                at org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.load(JavaModelManager.java:3144)
                at org.eclipse.jdt.internal.core.JavaModelManager.loadVariablesAndContainers(JavaModelManager.java:2980)
                at org.eclipse.jdt.internal.core.JavaModelManager.startup(JavaModelManager.java:4623)
                at org.eclipse.jdt.core.JavaCore.start(JavaCore.java:4965)
                at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
                at java.security.AccessController.doPrivileged(Native Method)
                at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
                at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
                at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
                at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
                at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
                at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
                at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
                at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
                at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
                at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:454)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
                at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                at java.lang.Class.getDeclaredConstructors0(Native Method)
                at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
                at java.lang.Class.getConstructor0(Unknown Source)
                at java.lang.Class.newInstance0(Unknown Source)
                at java.lang.Class.newInstance(Unknown Source)
                at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
                at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
                at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
                at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
                at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
                at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
                at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
                at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
                at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:457)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
                at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
                at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
                at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
                at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
                at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
                at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
                at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
                at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
                at org.eclipse.ui.internal.navigator.filters.CommonFilterDescriptor.createFilter(CommonFilterDescriptor.java:120)
                at org.eclipse.ui.internal.navigator.NavigatorFilterService.getViewerFilter(NavigatorFilterService.java:180)
                at org.eclipse.ui.internal.navigator.NavigatorFilterService.getVisibleFilters(NavigatorFilterService.java:150)
                at org.eclipse.ui.navigator.CommonNavigator.createPartControl(CommonNavigator.java:180)
                at org.eclipse.ui.navigator.resources.ProjectExplorer.createPartControl(ProjectExplorer.java:75)
                at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
                at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
                at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
                at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
                at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
                at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
                at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
                at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
                at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
                at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
                at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
                at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
                at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
                at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
                at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:982)
                at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
                at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2965)
                at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
                at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2946)
                at org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2263)
                at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
                at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
                at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
                at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3885)
                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3506)
                at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
                at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
                at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
                at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
                at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
                at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3885)
                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3506)
                at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
                at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
                at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
                at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
                at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
                at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
                at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
                at org.eclipse.equinox.launcher.Main.main(Main.java:1287)




Reproducible: Always

Steps to Reproduce:
1.Activate Eclipse with a clear workspace in the debug configuration
2.Create a General Project in Project Explorer
3.Create a new file in this project.
4.Type some text in this new file.
5.Exit Eclipse
6.Activate Eclipse without clearing the workspace.
7.May or may not need to do this but expand the tree node in Project Explorer so can see the newly created file.
8.Check the .log file, get the EOF Exception
Comment 1 Dani Megert CLA 2010-10-12 01:48:03 EDT
Which VM is it exactly? 64 bit?

Looks like a dup of bug 203725.

JDT Core team: someone should get such a VM and try the given steps to confirm that it's not an Eclipse problem.
Comment 2 Ayushman Jain CLA 2010-10-12 03:09:13 EDT
Satyam, please check with 64 bit VM.Thanks!
Comment 3 Missing name CLA 2010-10-12 12:05:05 EDT
This problem is recreatable with a x86-based PC.

I have more needed information to recreate this problem.  There are additional steps needed to recreate this problem.  Here are the steps in its entirety.

Steps to Reproduce:
1.Activate Eclipse with a clear workspace in the debug configuration.  Also include a plugin that creates a project while in Eclipse and closes the project when exiting from Eclipse.
2.Create a General Project in Project Explorer
3.Create a new file in this project.
4.Activate a plugin that creates a new project.
5.Check the variablesandcontainers.dat file in the plugin org.eclipse.jdt.core does not contain the project name created in step 4.
5.Exit Eclipse.  The plugin that created a new project in step 4 now closes the project.  
6. Check the variablesandcontainers.dat file in the plugin org.eclipse.jdt.core now contains the project name created in step 4.
6.Activate Eclipse without clearing the workspace.
7.Check the .log file, get the EOF Exception.


I am able to duplicate this problem with 2 different plugins from 2 different companies that creates a project/closes it.  If I comment out the code that closes the project, the variablesandcontainers.dat file does not contain the project name and the EOF Exception does not occur.  Why would the project name be inserted in the variablesandcontainers.dat file when the description of this .dat file is for classpath containers?
Comment 4 Missing name CLA 2010-10-12 14:13:47 EDT
More helpful information.  Prior to the EOF Exception, I always get the following:

!ENTRY org.eclipse.core.resources 2 10035 2010-10-12 14:00:30.043
!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

Also, here are snippets of the java program to create a project, and close the project

public class MyPlugin extends AbstractUIPlugin
{
        public static final String PROJECT_NAME = "my.project.name";
..............
............

/**
	 * This method is called upon plug-in activation.
	 * 
	 * @param context
	 *            The bundle
	 * 
	 * @throws Exception
	 */
	@Override
	public void start(BundleContext context) throws Exception
	{
		super.start(context);
		createProject(true);
		.....
		.....
	}

	/**
	 * This method is called when the plug-in is stopped.
	 * 
	 * @param context
	 *            The bundle
	 */
	@Override
	public void stop(BundleContext context) throws Exception
	{
		.....
		.....
		
		//
		//	Delete the project
		//
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
		IProject project = workspace.getRoot().getProject(PROJECT_NAME);
		project.close(null);
		project.delete(true, true, null);
		
		
		m_plugin = null;
		m_resourceBundle = null;
		super.stop(context);
		
	}

       	public static IProject createProject(boolean bDelete) throws CoreException
	{
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
		IProject project = workspace.getRoot().getProject(PROJECT_NAME);
		
		if ((bDelete == true) && (project.exists() == true))
		{
			project.close(null);
			project.delete(true, true, null);
		}
		
		if (project.exists() == false)
		{
			project.create(null);
		}
		
		project.open(null);
		
		return project;
	}
Comment 5 Satyam Kandula CLA 2010-10-12 21:33:05 EDT
(In reply to comment #4)
Thanks for the detailed instructions. I am able to reproduce the problem and am looking into it.
Comment 6 Olivier Thomann CLA 2010-11-29 15:11:01 EST
Moving to M5. APT memory issue had to be handled before this one.
Comment 7 Satyam Kandula CLA 2010-12-16 06:43:30 EST
Created attachment 185306 [details]
Proposed patch

The file variablesAndContainers.dat is always getting rewritten completely. It gets written on a save event. On a project save event, only the project details were getting written, which is not correct. The read assumes that everything is written properly. This does work at all other times as generally this is read only at the start and at the end the full workspace is generally saved. In this particular case, the event for the project save is happening after the workspace save causing the problem on the restart. 
Fixed by always writing the full contents immaterial of the save type.
Comment 8 Satyam Kandula CLA 2010-12-16 06:43:55 EST
Jay, Please review.
Comment 9 Jay Arthanareeswaran CLA 2010-12-17 01:54:42 EST
(In reply to comment #7)
> Created an attachment (id=185306) [details]
> Proposed patch

+1 for the patch. Please do not forget to comment out the TESTS_NAMES.
Comment 10 Satyam Kandula CLA 2010-12-20 06:39:14 EST
Created attachment 185526 [details]
Patch

Jay, Thanks for your review comments. 
Removed the changes to TESTS_NAMES and also updated the comment for the test.
Comment 11 Satyam Kandula CLA 2010-12-20 06:39:32 EST
Released in HEAD.
Comment 12 Olivier Thomann CLA 2011-01-25 09:09:23 EST
Verified using I20110124-1800
Comment 13 Olivier Thomann CLA 2011-02-25 13:55:49 EST
*** Bug 203725 has been marked as a duplicate of this bug. ***
Comment 14 Dani Megert CLA 2011-06-06 04:05:58 EDT
*** Bug 348339 has been marked as a duplicate of this bug. ***