Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 427421 - NumberFormatException in periodic Workspace Save Job
Summary: NumberFormatException in periodic Workspace Save Job
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 343977
Blocks:
  Show dependency tree
 
Reported: 2014-02-04 18:33 EST by Denis Golovin CLA
Modified: 2020-05-12 07:58 EDT (History)
5 users (show)

See Also:


Attachments
Zipped Logs (109.96 KB, application/x-zip-compressed)
2014-03-13 04:43 EDT, Martin Oberhuber CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Golovin CLA 2014-02-04 18:33:50 EST
It happens frequently in UI tests running with tycho 0.19.0

!ENTRY org.eclipse.core.jobs 4 2 2014-02-04 12:27:42.785
!MESSAGE An internal error occurred during: "Periodic workspace save.".
!STACK 0
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:454)
	at java.lang.Integer.<init>(Integer.java:677)
	at org.eclipse.core.internal.resources.SaveManager.validateMasterTableBeforeSave(SaveManager.java:1561)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1229)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1221)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1198)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1110)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.eclipse.core.jobs 4 2 2014-02-04 12:47:42.986
!MESSAGE An internal error occurred during: "Periodic workspace save.".
!STACK 0
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:454)
	at java.lang.Integer.<init>(Integer.java:677)
	at org.eclipse.core.internal.resources.SaveManager.validateMasterTableBeforeSave(SaveManager.java:1561)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1229)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1221)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1198)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1110)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 1 Szymon Ptaszkiewicz CLA 2014-02-05 06:26:11 EST
Thank you for this bug report. This is very interesting, especially that there is a dedicated check that should prevent from the NPE. Do you have any steps that can lead to this exception? What JVM do you use?
Comment 2 Szymon Ptaszkiewicz CLA 2014-02-05 06:28:00 EST
And also, what is the version of org.eclipse.core.resources plugin that you use?
Comment 3 Denis Golovin CLA 2014-02-05 12:53:16 EST
I am running UI tests in tycho using

Oracle Java 
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

and resources bundle is

org.eclipse.core.resources-3.9.0.v20140109-1640.jar


I have no steps, I wish I would.

It looks like race condition and something clears masterTable.
Comment 4 Szymon Ptaszkiewicz CLA 2014-02-05 13:22:35 EST
Thanks! As far as I can see, there is no tag equivalent to 3.9.0.v20140109-1640 in our public git repository, so could you please double-check what the content of line 1561 of SaveManager.java is?
Comment 5 Denis Golovin CLA 2014-02-05 14:02:03 EST
	private void validateMasterTableBeforeSave(java.io.File target) throws IOException {
		if (target.exists()) {
			MasterTable previousMasterTable = new MasterTable();
			SafeChunkyInputStream input = new SafeChunkyInputStream(target);
			try {
				previousMasterTable.load(input);
				String stringValue = previousMasterTable.getProperty(ROOT_SEQUENCE_NUMBER_KEY);
				// if there was a full save, then there must be a non-null entry for root
				if (stringValue != null) {
					int valueInFile = new Integer(stringValue).intValue();
1561 ->					int valueInMemory = new Integer(masterTable.getProperty(ROOT_SEQUENCE_NUMBER_KEY)).intValue();
					// new master table must provide greater or equal sequence number for root
					// throw exception if new value is lower than previous one - we cannot allow to desynchronize master table on disk
					String message = "Cannot set lower sequence number for root (previous: " + valueInFile + ", new: " + valueInMemory + "). Location: " + target.getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
					Assert.isLegal(valueInMemory >= valueInFile, message);
				}
			} finally {
				input.close();
			}
		}
	}
Comment 6 Denis Golovin CLA 2014-02-05 14:03:16 EST
ups, sorry it is not looking really good, do you see this "1561 ->"?
Comment 7 Szymon Ptaszkiewicz CLA 2014-02-05 14:23:24 EST
(In reply to Denis Golovin from comment #6)
> ups, sorry it is not looking really good, do you see this "1561 ->"?

Yes, it points at the line with "int valueInMemory = ...". Thanks a lot!

This is a timing issue that I have been chasing for a long time now. Thanks to your bug report, we now know that long standing issues like bug 149121 were caused by multiple master tables being used at the same time. Fix for bug 415014 replaced multiple master tables with just one master table, but timing issue is still there which is confirmed by this bug.

Whenever you see this problem again, please zip the workspace that is affected and attach it to this bug. What I'm looking for is whether there are any files in .metadata folder with the .bak extension that could be involved.
Comment 8 Denis Golovin CLA 2014-02-05 14:40:17 EST
one more note, it happens to me usually in debug sessions when main UI thread is suspended many times during tests execution.
Comment 9 Szymon Ptaszkiewicz CLA 2014-02-05 14:48:24 EST
(In reply to Denis Golovin from comment #8)
> one more note, it happens to me usually in debug sessions when main UI
> thread is suspended many times during tests execution.

That's valuable information. Suspending a thread should not interfere with periodic workspace save, so if it does, then it's another confirmation we have a bug.

Where do you take these UI tests from? If these are some UI tests from another eclipse.org project, please let me know and I will set up local environment to run them locally hoping I will be able to reproduce it. If not, maybe you can attach a test case that usually shows this bug? Any hint that can help me to reproduce it will be great.
Comment 10 Denis Golovin CLA 2014-02-05 15:10:52 EST
Latest test log is available through https://hudson.jboss.org/hudson/view/JBossTools/view/JBossTools_Master/job/jbosstools-javaee_master/lastSuccessfulBuild/artifact/sources/jsf/tests/org.jboss.tools.jsf.ui.test/target/work/data/.metadata/.log/*view*/, but it doesn't have this problem and most likely never had, because it is always running none stop. I really can see it only locally. I'll try do remote debugging for my local build to see if I can catch it.
Comment 11 Martin Oberhuber CLA 2014-03-11 23:11:32 EDT
CQ:WIND00-WB4-2543

We have also seen this message in Eclipse 4.3.1 , but during normal user interatction - no automation job as reported by Denis. I guess that having this appear as part of automation too is good since it provides a somewhat reproducable case.
Comment 12 Szymon Ptaszkiewicz CLA 2014-03-12 08:51:21 EDT
(In reply to Martin Oberhuber from comment #11)
> We have also seen this message in Eclipse 4.3.1 , but during normal user
> interatction - no automation job as reported by Denis. I guess that having
> this appear as part of automation too is good since it provides a somewhat
> reproducable case.

It's strange you see this in 4.3.1, because the change that, as far as I know, could cause this was pushed for 4.4 M2 as a fix for bug 415014. Can you please attach full stack trace, so that I can see exact line numbers where the exception occurs?
Comment 13 Martin Oberhuber CLA 2014-03-13 04:43:27 EDT
Created attachment 240843 [details]
Zipped Logs

Zipped Logs attached. The "configuration" file in the logs clearly identifies Eclipse as version 4.3.1, as far as I can tell. The reported exception is this:


!ENTRY org.eclipse.core.jobs 4 2 2014-01-24 15:15:39.915
!MESSAGE An internal error occurred during: "Periodic workspace save.".
!STACK 0
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Unknown Source)
	at java.lang.Integer.<init>(Unknown Source)
	at org.eclipse.core.internal.resources.SaveManager.validateMasterTableBeforeSave(SaveManager.java:1560)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1228)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1220)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1197)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1109)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 14 Szymon Ptaszkiewicz CLA 2014-04-28 11:34:24 EDT
Unfortunately, we still don't know why in the new master table there is no value for ROOT_SEQUENCE_NUMBER_KEY. From logs attached in comment 13 we know that it happens also on Windows.
Comment 15 Szymon Ptaszkiewicz CLA 2015-03-25 11:36:01 EDT
We have not been able to reproduce this. Removing target milestone because there is nothing more we can do right now. Please speak up with if you can still reproduce this problem in Eclipse 4.4.2 or later and please provide steps how to reproduce it.
Comment 16 Reinhold Schiess CLA 2015-06-03 13:13:50 EDT
I can reproduce this error in Eclipse 4.4.0 like this:


workspace on a removable drive

eclipse on a windows notebook.

with opened workspace put notebook into suspended mode

remove drive

power up notebook, doing nothing in the workspace

re-plug removable drive. Drive letter is the same as before 

-> everything works in Eclipse, except that I get the error periodically until Eclipse is restarted

!ENTRY org.eclipse.core.jobs 4 2 2015-06-03 08:05:03.388
!MESSAGE An internal error occurred during: "Periodic workspace save.".
!STACK 0
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Unknown Source)
	at java.lang.Integer.<init>(Unknown Source)
	at org.eclipse.core.internal.resources.SaveManager.validateMasterTableBeforeSave(SaveManager.java:1562)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1229)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1221)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1198)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1110)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 17 Martin Oberhuber CLA 2015-07-29 09:19:52 EDT
Ping, since the last comment has a reproducable case could this be investigated ?
Comment 18 Szymon Ptaszkiewicz CLA 2015-07-30 09:34:52 EDT
(In reply to Martin Oberhuber from comment #17)
> Ping, since the last comment has a reproducable case could this be
> investigated ?

Were you able to reproduce the problem using these steps?
Comment 19 John Boyland CLA 2016-07-27 10:29:44 EDT
I have this problem too with Eclipse Luna (4.4.0) on Ubuntu 14.04 java 1.7.0_101
It happens if the workspace is under AFS and my AFS token expires.  Getting new tokens doesn't make the problem go away.  I suspect that a periodic save attempted while I didn't have write access to the workspace messes things up, and then later attempts fail with the NumberFormatException.

NB: It might be better if Eclipse didn't try to periodically save the workspace when nothing has changed since the last save.
Comment 20 Szymon Ptaszkiewicz CLA 2016-07-28 02:40:03 EDT
(In reply to John Boyland from comment #19)
> I have this problem too with Eclipse Luna (4.4.0) on Ubuntu 14.04 java
> 1.7.0_101
> It happens if the workspace is under AFS and my AFS token expires.  Getting
> new tokens doesn't make the problem go away.  I suspect that a periodic save
> attempted while I didn't have write access to the workspace messes things
> up, and then later attempts fail with the NumberFormatException.
> 
> NB: It might be better if Eclipse didn't try to periodically save the
> workspace when nothing has changed since the last save.

Can you please clarify what is AFS?
Comment 21 John Boyland CLA 2016-07-28 09:02:02 EDT
(In reply to Szymon Ptaszkiewicz from comment #20)
> (In reply to John Boyland from comment #19)
> > I have this problem too with Eclipse Luna (4.4.0) on Ubuntu 14.04 java
> > 1.7.0_101
> > It happens if the workspace is under AFS and my AFS token expires.  Getting
> > new tokens doesn't make the problem go away.  I suspect that a periodic save
> > attempted while I didn't have write access to the workspace messes things
> > up, and then later attempts fail with the NumberFormatException.
> > 
> > NB: It might be better if Eclipse didn't try to periodically save the
> > workspace when nothing has changed since the last save.
> 
> Can you please clarify what is AFS?

A distributed file system.  Somewhat like drop box.  See openafs.org
Comment 22 Eric Perret CLA 2018-01-25 18:07:17 EST
I am receiving this with the latest version of eclipse.  Is there any workaround I can try?

java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.parseInt(Integer.java:615)
	at org.eclipse.core.internal.resources.SaveManager.validateMasterTableBeforeSave(SaveManager.java:1617)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1285)
	at org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.java:1277)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1254)
	at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1165)
	at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:52)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

eclipse.buildId=4.7.2.M20171130-0510
java.version=1.8.0_131
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -refresh
Command-line arguments:  -os linux -ws gtk -arch x86_64 -data ~/eclipse-workspaces/app.main -refresh
Comment 23 Eric Perret CLA 2018-01-25 18:38:24 EST
(In reply to Eric Perret from comment #22)
> I am receiving this with the latest version of eclipse.  Is there any
> workaround I can try?
> 
> java.lang.NumberFormatException: null
> 	at java.lang.Integer.parseInt(Integer.java:542)
> 	at java.lang.Integer.parseInt(Integer.java:615)
> 	at
> org.eclipse.core.internal.resources.SaveManager.
> validateMasterTableBeforeSave(SaveManager.java:1617)
> 	at
> org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.
> java:1285)
> 	at
> org.eclipse.core.internal.resources.SaveManager.saveMasterTable(SaveManager.
> java:1277)
> 	at
> org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1254)
> 	at
> org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1165)
> 	at
> org.eclipse.core.internal.resources.DelayedSnapshotJob.
> run(DelayedSnapshotJob.java:52)
> 	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
> 
> eclipse.buildId=4.7.2.M20171130-0510
> java.version=1.8.0_131
> java.vendor=Oracle Corporation
> BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
> Framework arguments:  -refresh
> Command-line arguments:  -os linux -ws gtk -arch x86_64 -data
> ~/eclipse-workspaces/app.main -refresh

This is using Ubuntu 16.04 LTS and I have full hard drive encryption enabled.
Comment 24 Eclipse Genie CLA 2020-05-12 07:58:09 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.