Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile TARGET_DEFINITION:resource:/target-platform/target-platform.target is not current. #580

Open
laeubi opened this issue Apr 17, 2023 · 4 comments

Comments

@laeubi
Copy link
Contributor

laeubi commented Apr 17, 2023

From time to time I see the following error:

java.lang.IllegalStateException: Profile TARGET_DEFINITION:resource:/target-platform/target-platform.target is not current. Expected timestamp 1681745081745 but was 1681745007669.
	at org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry.lockProfile(SimpleProfileRegistry.java:880)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:72)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:48)
	at org.eclipse.pde.internal.core.target.P2TargetUtils.resolveWithPlanner(P2TargetUtils.java:1042)
	at org.eclipse.pde.internal.core.target.P2TargetUtils.synchronize(P2TargetUtils.java:828)
	at org.eclipse.pde.internal.core.target.TargetDefinition.resolve(TargetDefinition.java:404)
	at org.eclipse.pde.internal.ui.editor.targetdefinition.TargetEditor$TargetChangedListener$1.run(TargetEditor.java:606)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

this opens a error dialog but I can't see what does not work or what a user should do, so I see the following options:

  1. ignore the error (don't show a popup) if this does not harm
  2. handle the error (e.g. restart the operation or similar)
  3. Show useful guidance whats wrong and what a user should to to resolve the issue.

@merks any idea what this is supposed to mean? should P2TargetUtils maybe start another resolve in that case?

@merks
Copy link
Contributor

merks commented Apr 18, 2023

This method does a reset:

	private boolean checkTimestamps(IProfile profile, IProfile internalProfile) {
		long[] timestamps = listProfileTimestamps(profile.getProfileId());
		if (timestamps.length == 0) {
			if (DebugHelper.DEBUG_PROFILE_REGISTRY)
				DebugHelper.debug(PROFILE_REGISTRY, "check timestamp: expected " + profile.getTimestamp() + " but no profiles were found"); //$NON-NLS-1$ //$NON-NLS-2$
			resetProfiles();
			return false;
		}

		long currentTimestamp = timestamps[timestamps.length - 1];
		if (profile.getTimestamp() != currentTimestamp) {
			if (DebugHelper.DEBUG_PROFILE_REGISTRY)
				DebugHelper.debug(PROFILE_REGISTRY, "check timestamp: expected " + profile.getTimestamp() + " but was " + currentTimestamp); //$NON-NLS-1$ //$NON-NLS-2$
			if (internalProfile.getTimestamp() != currentTimestamp)
				resetProfiles();
			return false;
		}

		return true;
	}

So I think it "fixes" the problem such that you could retry afterwards...

@laeubi
Copy link
Contributor Author

laeubi commented Apr 18, 2023

I currently can "fix" it by closing the target editor and reopen it so it seams that at least somewhere it can "escape" from that check. Or do you mean the method should catch the error and call perform again.

@merks
Copy link
Contributor

merks commented Apr 18, 2023

The caller of that method throws an exception to terminate but at that point, it appears that the problem is "fixed" because of the reset call. What PDE might do is try to lock and unlock the profile early, and maybe try a second time if the first time fails, and then proceed. I'm not sure how feasible that is...

@cdietrich
Copy link
Contributor

i still see this on a regular basis in my oomphed xtext workspace after restarting

java.lang.IllegalStateException: Profile TARGET_DEFINITION:resource:/xtext-parent/xtext-latest.target is not current. Expected timestamp 1741352717039 but was 1741352715765.
	at org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry.lockProfile(SimpleProfileRegistry.java:870)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:73)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:49)
	at org.eclipse.pde.internal.core.target.P2TargetUtils.resolveWithPlanner(P2TargetUtils.java:1111)
	at org.eclipse.pde.internal.core.target.P2TargetUtils.synchronize(P2TargetUtils.java:837)
	at org.eclipse.pde.internal.core.target.TargetDefinition.lambda$3(TargetDefinition.java:402)
	at java.base/java.util.HashMap.forEach(HashMap.java:1429)
	at org.eclipse.pde.internal.core.target.TargetDefinition.resolve(TargetDefinition.java:399)
	at org.eclipse.pde.internal.ui.editor.targetdefinition.TargetEditor$TargetChangedListener$1.run(TargetEditor.java:678)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants