Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » IncrementalBuild loop in XText 2.11(IncrementalBuild loop in XText 2.11)
IncrementalBuild loop in XText 2.11 [message #1766711] Mon, 26 June 2017 13:01 Go to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
I have the problem in a much bigger and customized project, but it also happens in a small default project

grammar org.xtext.example.mydsl1.BuildLoop with org.eclipse.xtext.common.Terminals

generate buildLoop "http://www.xtext.org/example/mydsl1/BuildLoop"

import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Loop: name=ID statements+=Statement+;

Statement: LoopRef | SimpleStatement | OtherName;

LoopRef: 'LOOP' ref=[Loop];

SimpleStatement: val=ID;

OtherName: 'OTHERNAME' name=ID;


Create a sample project and create the file src\test\LOOP1.loop

LOOP1

OTHERNAME other


Create a Java class to generate files with references to LOOP1

		for (int i = 1; i < 200; i++) {
			StringBuffer sb = new StringBuffer();
			sb.append("LOOPGEN").append(i).append("\n")
				.append("LOOP LOOP1\n")
				.append("\n");
			
			for (int j = 0 ; j < 500; j++) {
				sb.append("lkjdaskljdklasdj askldj askldj askldj askldj askldj a\n");
			}
			Files.write(Paths.get("C:\\workspaces\\runtime-New_configuration\\testCycle4\\src\\gen\\LOOPGEN"+i+".loop"), sb.toString().getBytes());
		}


The generated files will be something like this:

LOOPGEN1
LOOP LOOP1

lkjdaskljdklasdj askldj askldj askldj askldj askldj a
lkjdaskljdklasdj askldj askldj askldj askldj askldj a
............


Follow the steps:

* Clean: it works ok
* Change 'OTHERNAME other' for 'OTHERNAME other2'. Incremental build recompiles all dependencies ok
* Modify 'LOOP1' and change it to 'LOOP2'. Incremental build starts but it cancels, start again, etc. It doesn't never end
* Change LOOP2 to LOOP1. Incremental build starts but it cancels, start again, etc. It doesn't end never end
* Clean: it works ok
* Change 'OTHERNAME other' for 'OTHERNAME other2'. Incremental build recompiles all dependencies ok (if LOOP1 is the ID, if it's not nothing references the file)
* Modify 'LOOP1' and change it to 'LOOP2'. Incremental build starts but it cancels, start again, etc. It doesn't never end
...

Almost always it loops, but if it doesn't, closing and opening the project usually makes it happend again (after changing LOOP1).

It doen't happen if there's only a few files or if the files are shorter and compile faster.

I've debugged the XText code and i can see that the progress associated is canceled and it triggers a restart, but i cannot see why.

Any ideas?

Thanks
Re: IncrementalBuild loop in XText 2.11 [message #1766712 is a reply to message #1766711] Mon, 26 June 2017 13:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
do you have polling for external changes enabled in eclipse?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IncrementalBuild loop in XText 2.11 [message #1766713 is a reply to message #1766712] Mon, 26 June 2017 13:09 Go to previous messageGo to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
No, default preferences: "Build automatically" and "Refresh on access"
Re: IncrementalBuild loop in XText 2.11 [message #1766714 is a reply to message #1766713] Mon, 26 June 2017 13:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
hmm could have been https://bugs.eclipse.org/bugs/show_bug.cgi?id=486083

so you should debug who interrupts autobuild. one candidate could be e.g. subclipse working on generated resources.
maybe generation files without ifile api might be bad ass well.
since eclipse/xtext call refresh during build and might pick it up


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IncrementalBuild loop in XText 2.11 [message #1766756 is a reply to message #1766714] Mon, 26 June 2017 22:01 Go to previous messageGo to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
I tried to debug in my work but i couldn't download eclipse source files because of proxy problems ...

The environment was Eclipse 4.6.3 Xtext 2.11 Windows
I've tested in home with Eclipse 4.6.3 Xtext 2.12 Linux and it also happens

Following the advice to debug around:

org.eclipse.xtext.builder.impl.XtextBuilder.handleCanceled(Throwable)
org.eclipse.core.resources.IncrementalProjectBuilder.forgetLastBuiltState()
org.eclipse.core.internal.events.AutoBuildJob.setInterrupted(boolean)

I've found that XTextBuilder detects that is blocking a previous Job "JPA Project Change Event Handler(1044)" with more priority and decides to cancel.
This job is from "Dali Java Persistence Tools -JPA Support".

It seems to be the problem to some other plugins like Spring STS and others: https://jira.spring.io/browse/STS-4416

Some people say that disabling JPA validation is enough, but the project does not have the facet and also disabling al validation does not solve it.
Uninstalling the plugin does solve it though, but i'm not sure if i will miss anything necessary ...

Do you think it's more an inherent problem of Xtext build system or a bad behaviour of "Dali JPA"?
Is there anything to do other than removing the plugin?

I'll test tomorow with the real project.

Thanks,

Sergio

	JobManager.isBlocking(InternalJob) line: 824	
		while (previous != null) {
			// ignore jobs of lower priority (higher priority value means lower priority)
			if (previous.getPriority() < runningJob.getPriority()) {
				if (!previous.isSystem())
					return true;



		runningJob=Building workspace(4)
		  .priority=40
		  .previous=JPA Project Change Event Handler(1044)
		previous=JPA Project Change Event Handler(1044)
		  .previous=null
		  .priority=30


	Thread [Worker-20] (Suspended (breakpoint at line 824 in JobManager)) (out of synch)	
		owns: Object  (id=655)	
		owns: AutoBuildJob  (id=136)	
		owns: ClusteringBuilderState  (id=262)	
		JobManager.isBlocking(InternalJob) line: 824	
		AutoBuildJob(InternalJob).isBlocking() line: 316	
		AutoBuildJob(Job).isBlocking() line: 443	
		AutoBuildJob.isInterrupted() line: 203 (out of synch)	
		XtextBuilder(InternalBuilder).isInterrupted() line: 171 (out of synch)	
		XtextBuilder(IncrementalProjectBuilder).isInterrupted() line: 333 (out of synch)	
		XtextBuilder.shouldCancelBuild(int) line: 189	
		XtextBuilder.access$1(XtextBuilder, int) line: 188	
		XtextBuilder$2.isCanceled() line: 146	
		SubMonitor$RootInfo.isCanceled() line: 280	
		SubMonitor.isCanceled() line: 616	
		DefaultResourceUIValidatorExtension$1.isCanceled() line: 86	
		OperationCanceledManager.xtend line: 76	
		LazyLinkingResource.resolveLazyCrossReferences(CancelIndicator) line: 127	
		EcoreUtil2.resolveLazyCrossReferences(Resource, CancelIndicator) line: 498	
		ResourceValidatorImpl.resolveProxies(Resource, CancelIndicator) line: 161	
		ResourceValidatorImpl.validate(Resource, CheckMode, CancelIndicator) line: 74	
		DefaultResourceUIValidatorExtension.addMarkers(IFile, Resource, CheckMode, IProgressMonitor) line: 60	
		DefaultResourceUIValidatorExtension.updateValidationMarkers(IFile, Resource, CheckMode, IProgressMonitor) line: 46	
		MarkerUpdaterImpl.processDelta(IResourceDescription$Delta, ResourceSet, IProgressMonitor) line: 93	
		MarkerUpdaterImpl.updateMarkers(IResourceDescription$Delta, ResourceSet, IProgressMonitor) line: 63	
		ClusteringBuilderState(AbstractBuilderState).updateMarkers(IResourceDescription$Delta, ResourceSet, IProgressMonitor) line: 82	
		ClusteringBuilderState.doUpdate(BuildData, ResourceDescriptionsData, IProgressMonitor) line: 283	
		ClusteringBuilderState(AbstractBuilderState).update(BuildData, IProgressMonitor) line: 116	
		XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor, IXtextBuilderParticipant$BuildType) line: 287	
		XtextBuilder.incrementalBuild(IResourceDelta, IProgressMonitor) line: 267	
		XtextBuilder.build(int, Map, IProgressMonitor) line: 161	
		BuildManager$2.run() line: 735 (out of synch)	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 206 (out of synch)	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 246 (out of synch)	
		BuildManager$1.run() line: 301 (out of synch)	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 304 (out of synch)	
		BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 360 (out of synch)	
		BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 383 (out of synch)	
		AutoBuildJob.doBuild(IProgressMonitor) line: 144 (out of synch)	
		AutoBuildJob.run(IProgressMonitor) line: 235 (out of synch)	
		<obsolete method in<unknown declaring type>>	


Thread [Worker-17] (Suspended (breakpoint at line 251 in AutoBuildJob))	
		owns: AutoBuildJob  (id=136)	
		owns: ClusteringBuilderState  (id=262)	
		AutoBuildJob.setInterrupted(boolean) line: 251	
		AutoBuildJob.isInterrupted() line: 204	
		XtextBuilder(InternalBuilder).isInterrupted() line: 171	
		XtextBuilder(IncrementalProjectBuilder).isInterrupted() line: 333	
		XtextBuilder.shouldCancelBuild(int) line: 189	
		XtextBuilder.access$1(XtextBuilder, int) line: 188	
		XtextBuilder$2.isCanceled() line: 146	
		SubMonitor$RootInfo.isCanceled() line: 280	
		SubMonitor.isCanceled() line: 616	
		MarkerUpdaterImpl.updateMarkers(IResourceDescription$Delta, ResourceSet, IProgressMonitor) line: 60	
		ClusteringBuilderState(AbstractBuilderState).updateMarkers(IResourceDescription$Delta, ResourceSet, IProgressMonitor) line: 82	
		ClusteringBuilderState.doUpdate(BuildData, ResourceDescriptionsData, IProgressMonitor) line: 283	
		ClusteringBuilderState(AbstractBuilderState).update(BuildData, IProgressMonitor) line: 116	
		XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor, IXtextBuilderParticipant$BuildType) line: 287	
		XtextBuilder.incrementalBuild(IResourceDelta, IProgressMonitor) line: 267	
		XtextBuilder.build(int, Map, IProgressMonitor) line: 161	
		BuildManager$2.run() line: 735	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 206	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 246	
		BuildManager$1.run() line: 301	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 304	
		BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 360	
		BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 383	
		AutoBuildJob.doBuild(IProgressMonitor) line: 144	
		AutoBuildJob.run(IProgressMonitor) line: 235	
		Worker.run() line: 55	


	Thread [Worker-20] (Suspended) (out of synch)	
		XtextBuilder.handleCanceled(Throwable) line: 198	
		XtextBuilder.build(int, Map, IProgressMonitor) line: 168	
		BuildManager$2.run() line: 735 (out of synch)	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(int, IncrementalProjectBuilder, Map<String,String>, MultiStatus, IProgressMonitor) line: 206 (out of synch)	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, ICommand[], MultiStatus, IProgressMonitor) line: 246 (out of synch)	
		BuildManager$1.run() line: 301 (out of synch)	
		SafeRunner.run(ISafeRunnable) line: 42	
		BuildManager.basicBuild(IBuildConfiguration, int, IBuildContext, MultiStatus, IProgressMonitor) line: 304 (out of synch)	
		BuildManager.basicBuildLoop(IBuildConfiguration[], IBuildConfiguration[], int, MultiStatus, IProgressMonitor) line: 360 (out of synch)	
		BuildManager.build(IBuildConfiguration[], IBuildConfiguration[], int, IProgressMonitor) line: 383 (out of synch)	
		AutoBuildJob.doBuild(IProgressMonitor) line: 144 (out of synch)	
		AutoBuildJob.run(IProgressMonitor) line: 235 (out of synch)	
		<obsolete method in<unknown declaring type>>	



Re: IncrementalBuild loop in XText 2.11 [message #1766763 is a reply to message #1766756] Tue, 27 June 2017 03:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
There is this job prio comparison done?
Inside eclipse or inside Xtext?
I assume inside eclipse and Xtext is only a good citizen
And respects the cancellation it receives
Thus I assume it's a problem with the jpa job


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IncrementalBuild loop in XText 2.11 [message #1766769 is a reply to message #1766763] Tue, 27 June 2017 07:02 Go to previous message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
Yes, it seems XtextBuilder is only asking for "isInterrupted", which is implemented in "InternalBuilder" as "return buildManager.autoBuildJob.isInterrupted();"
"AutoBuildJob.isInterrupted" does "if (isBlocking()) setInterrupted(true);"
And "isBlocking" is the function i posted before looking for previous jobs with more priority
Previous Topic:Question concerning package for IValueConverter
Next Topic:How to exclude resources from build
Goto Forum:
  


Current Time: Fri Sep 24 13:21:28 GMT 2021

Powered by FUDForum. Page generated in 0.01768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top