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

Attempted to beginRule: MultiRule[], does not match outer scope rule: R/ #1214

Closed
basilevs opened this issue Mar 29, 2024 · 1 comment · Fixed by #1216
Closed

Attempted to beginRule: MultiRule[], does not match outer scope rule: R/ #1214

basilevs opened this issue Mar 29, 2024 · 1 comment · Fixed by #1216

Comments

@basilevs
Copy link
Contributor

basilevs commented Mar 29, 2024

Prerequisites

  • Two distinct installations of Java
  • Eclipse IDE for Eclipse Committers 2024-03

Test steps

  • Open a fresh empty workspace
  • Create a single project of General type (no natures, no builders)
  • Restart
  • Open Preferences/Plugin Dvelopment/Target platform (no need to change anything, just make sure the page opens)
  • Open Preferences/Java/Installed JREs
  • Add (or remove) a second installation of Java
  • Hit Apply and Close

Note: to reproduce repeatedly, repeat last 3 steps

Expected result

No errors

Actual result

eclipse.buildId=4.31.0.20240307-1200
java.version=17.0.4.1
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=aarch64, WS=cocoa, NL=en_GE
Framework arguments:  -product org.eclipse.epp.package.committers.product
Command-line arguments:  -os macosx -ws cocoa -arch aarch64 -product org.eclipse.epp.package.committers.product

org.eclipse.core.jobs
Error
Fri Mar 29 14:34:41 GET 2024
An internal error occurred during: "Re-resolve Target state after VM-Install or EE change".

java.lang.IllegalArgumentException: Attempted to beginRule: MultiRule[], does not match outer scope rule: R/
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:68)
	at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:144)
	at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:416)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:88)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:341)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:124)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2398)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:601)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2448)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:642)
	at org.eclipse.core.internal.resources.Project.build(Project.java:162)
	at org.eclipse.pde.internal.core.MinimalState.reloadSystemPackagesIntoState(MinimalState.java:339)
	at org.eclipse.pde.internal.core.MinimalState$2.runInWorkspace(MinimalState.java:312)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Workaround

Keep a dummy project with PDE nature in the workspace.

Also observed when RCPTT loads an Appllication Under Test with a new VM

@basilevs
Copy link
Contributor Author

basilevs commented Mar 29, 2024

ManifestConsistencyChecker wants to lock all PDE projects and produces an empty MultiRule:

@Override
public ISchedulingRule getRule(int kind, Map<String, String> args) {
return new MultiRule(Arrays.stream(getProject().getWorkspace().getRoot().getProjects())
		.filter(PDEBuilderHelper::isPDEProject).toArray(ISchedulingRule[]::new));
}

Empty MultiRule does not conflict with workspace root, and is treated as an external entity in the context of the whole-workspace operation.

The builders can't just return null, as BuildManager will then fall-back to a full-workspace lock:

// Bug 306824 - Builders returning a null rule can't work safely if other builders require a non-null rule
// Be pessimistic and fall back to the default build rule (workspace root) in this case.
if (!hasNullBuildRule)
	return new MultiRule(rules.toArray(new ISchedulingRule[rules.size()]));
...
return workspace.getRoot();

So when builder does not need to lock any resources, it has to return a rule that is contained in workspace, but does not conflict with any resources. A non-existent project would do.

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

Successfully merging a pull request may close this issue.

1 participant