You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Instantiation can be started while workspace is building #2456
/* Wait for any builds to finish: Taken from DebugUIPlugin.launchInBackground(). */
final IJobManager jobManager = Job.getJobManager();
try {
jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, subMonitor.split(1));
jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, subMonitor.split(1));
} catch (InterruptedException e) {
/* just continue. */
}
to the start of AbstractInstantiationJob.runInWorkspace(). Two things:
It definitely blocks the job, and the progress display says that it is waiting for "Build" to complete.
The problem is that something about the job cause the "Build" job to wait as well, so they become deadlocked.
I took the join calls back out of the AbstractInstantiationJob and tried things. The instantiation jobs cause the build to pause. Not sure why, perhaps because they lock output directory for file creation?
Had to do the following in AbstractInstantiationEngine.instantiate()
What for the build to finish. This doesn't need to be a separate job because instantiate() declares that it does not return until instantiation is complete.
When the builder is finished create and schedule the instantiation jobs and the results collection job.
Wait for the results job to finish (as originally done)
The key things here seem to be
Not requiring any resources. When I tried to have the instantiation jobs wait for the builder directly, the builder would suspend and wait for them. If I removed the resource requirement as a test (it would be wrong to remove it for real) then the builder didn't suspend. I have no idea how the builder is creating this behavior.
I tried to changing the jobs to have the BUILD priority, but that didn't matter.
There is definitely some Eclipse magic at work here that I don't understand, but I ahve been able to make this work, I think.
Also, starting a build while the instantiation is already running causes the build to wait for the instantiation to finish. Again, I have no idea why this is the case and how the builder is doing this. There may magic in the Eclipse job scheduler itself?
To do: Still to need to check that cancellation works correctly.
Running a task with Workspace.run() causes an interrupt and reschedule of the auto build
The auto build periodically checks if a job with a conflicting rule is waiting to run (that is, is being blocked by the auto build). If so, the auto build interrupts and reschedules itself.
Activity
AaronGreenhouse commentedon Oct 20, 2020
I wasn't able to make anything bad happen by doing this, but I have figured out how to make the instantiation jobs wait for the builder to finish.
See
DebugUIPlugin.launchInBackground()for how to do this.AaronGreenhouse commentedon Oct 20, 2020
This needs to branch from the Issue #841 branch so that everything that instantiates can take advantage of the waiting.
Created branch
2456_no_instantiation_during_buildrooted at branch841_instantiate_on_analysisAaronGreenhouse commentedon Oct 23, 2020
This is more complicated than it initially seems.
I added
to the start of
AbstractInstantiationJob.runInWorkspace(). Two things:It definitely blocks the job, and the progress display says that it is waiting for "Build" to complete.
The problem is that something about the job cause the "Build" job to wait as well, so they become deadlocked.
I took the join calls back out of the
AbstractInstantiationJoband tried things. The instantiation jobs cause the build to pause. Not sure why, perhaps because they lock output directory for file creation?AaronGreenhouse commentedon Oct 27, 2020
@lwrage Suggests looking at this https://www.eclipse.org/forums/index.php/m/1816939/#msg_1816939 regarding job priorities.
AaronGreenhouse commentedon Oct 28, 2020
Had to do the following in
AbstractInstantiationEngine.instantiate()instantiate()declares that it does not return until instantiation is complete.The key things here seem to be
BUILDpriority, but that didn't matter.There is definitely some Eclipse magic at work here that I don't understand, but I ahve been able to make this work, I think.
Also, starting a build while the instantiation is already running causes the build to wait for the instantiation to finish. Again, I have no idea why this is the case and how the builder is doing this. There may magic in the Eclipse job scheduler itself?
To do: Still to need to check that cancellation works correctly.
AaronGreenhouse commentedon Oct 29, 2020
Cancellation is okay
AaronGreenhouse commentedon Oct 29, 2020
Some things learned about the builder:
AutoBuildJobWorkspace.run()causes an interrupt and reschedule of the auto build