Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358678 - ATL stack overflow (Caused by: java.lang.ArrayIndexOutOfBoundsException: 100) in refining mode with atl2010 compiler (not with atl2006)
Summary: ATL stack overflow (Caused by: java.lang.ArrayIndexOutOfBoundsException: 100)...
Status: CLOSED FIXED
Alias: None
Product: MMT.ATL
Classification: Modeling
Component: emfvm (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Frederic Jouault CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 19:09 EDT by Thierry Beucher CLA
Modified: 2017-06-05 08:42 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Beucher CLA 2011-09-22 19:09:48 EDT
Build Identifier: 20110218-0911

symptom :

org.eclipse.m2m.atl.engine.emfvm.VMException: 100
	at __applyRefiningTrace__#47(plapiRefine_2.atl)
		local variables: self=plapiRefine_2 : ASMModule
	at main#56(plapiRefine_2.atl)
		local variables: self=plapiRefine_2 : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: 100
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:647)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:389)
	at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:234)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1128)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 100
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:495)
	... 12 more

This exception occurs only for refining mode transformation with new atl2010 compiler BUT NOT with atl2006, which denote propably a regression bug.

My ATL version is 3.2.1

ATL internal stack is limited in depth to 100 items implemented as an array of Object. 

The stack depth increase continuously: see below the trace displayed preceeding the exception :

(I added "println" in source code of org.eclipse.m2m.atl.engine.emfvm.ASMOperation
...
  try {
    while (pc < nbBytecodes) {
      System.out.println("---stack="+fp);
      Bytecode bytecode = bytecodes[pc++];
...)

resulting trace :

...
---stack=96
---stack=97
---stack=97
---stack=97
---stack=96
---stack=97
---stack=98
---stack=98
---stack=98
---stack=97
---stack=98
---stack=99
---stack=99
---stack=99
---stack=98
---stack=99
---stack=100
---stack=100
---stack=100
---stack=99
---stack=100

More, it seems that, unlike with atl2006, each rule execution let the stack in non-empty state. And the exception may occurs or not depending on the number of rules in the transformation (in my case, setting MAX_STACK = 10000 instead of 100, the depth reached 205 with 3 rules)

Nevertheless, I think the problem is more likely located in asm file produced with atl2010 compiler.

Reproducible: Always
Comment 1 Ronan Barrett CLA 2012-10-04 09:15:58 EDT
Hi,
I can't provide a fix but I can share some expereince on this error. I assume this is related to the known issue where variables defined in a rule are left on the stack even after the rule has finished execution. I have seen this occur in non refining mode rules. This can be fixed by creating a stack eater variable in the using section of a rule and then assigning the result of an operation in a do rule to this variable. ATL then cleans up the stack.

As your issue is in refining mode i'm not sure if you can do anything to fix this yourself.

Regards,
Ronan
Comment 2 Frederic Jouault CLA 2013-10-29 10:26:13 EDT
A test case has been created to reproduce this issue:
http://git.eclipse.org/c/mmt/org.eclipse.atl.git/commit/?id=44f8f2062185639cd7382c7bcc322d3f1352a9bb

Correction has been implemented and tested, and should be committed soon.
Comment 3 Frederic Jouault CLA 2013-10-29 12:51:47 EDT
A fix for this issue has been committed:
http://git.eclipse.org/c/mmt/org.eclipse.atl.git/commit/?id=a350a28b57f219adc0cce9699ade207d7178e735
Comment 4 Ronny Stauffer CLA 2014-01-23 16:15:31 EST
Which ATL version contains the fix? 3.5.0M4?
Comment 5 Frederic Jouault CLA 2014-01-24 08:48:04 EST
Any version after http://git.eclipse.org/c/mmt/org.eclipse.atl.git/commit/?id=404bc10555b526341ce92c211f55906e86c25c9c (inclusive) should work. Therefore, 3.5M4 should have the fix.
Comment 6 Dennis Wagelaar CLA 2017-06-05 08:42:15 EDT
This was released for ATL 3.5 - closing.