Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
Do-together bug - OSX - 2.0.7, 2.2 beta
Old
jeremyhu
Guest
 
Status:
Posts: n/a
Default Do-together bug - OSX - 2.0.7, 2.2 beta - 07-17-2008, 01:54 AM

The following world demonstrates a bug in Alice 2.0.7 that is still present in 2.2. An error occurs when you press up during the simulation. The world that demonstrates this bug can be found here:

http://cloud.cs.berkeley.edu/~jeremy/buggy.a2w

And the java stack trace...

Error during simulation.


Alice version: 2.0.7
os.name: Mac OS X
os.version: 10.5.4
os.arch: i386
java.vm.name: Java HotSpot(TM) Client VM
java.vm.version: 1.4.2-85
user.dir: /Applications/Alice.app/Contents/Required

Throwable that caused the error:
java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,2)
at edu.cmu.cs.stage3.alice.core.Behavior$Fork.getNext (Behavior.java:113)
at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack .top(Behavior.java:55)
at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack .pop(Behavior.java:48)
at edu.cmu.cs.stage3.alice.core.Behavior.closeFork(Be havior.java:176)
at edu.cmu.cs.stage3.alice.core.response.DoTogether$R untimeDoTogether.epilogue(DoTogether.java:85)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.DoTogether$R untimeDoTogether.epilogue(DoTogether.java:81)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.LoopNInOrder $RuntimeLoopNInOrder.epilogue(LoopNInOrder.java:99 )
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.CallToUserDe finedResponse$RuntimeCallToUserDefinedResponse.epi logue(CallToUserDefinedResponse.java:94)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.DoTogether$R untimeDoTogether.epilogue(DoTogether.java:81)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.childrenEpiloguesIf Necessary(CompositeResponse.java:67)
at edu.cmu.cs.stage3.alice.core.response.CompositeRes ponse$RuntimeCompositeResponse.epilogue(CompositeR esponse.java:73)
at edu.cmu.cs.stage3.alice.core.response.CallToUserDe finedResponse$RuntimeCallToUserDefinedResponse.epi logue(CallToUserDefinedResponse.java:94)
at edu.cmu.cs.stage3.alice.core.behavior.AbstractCond itionalBehavior.internalSchedule(AbstractCondition alBehavior.java:112)
at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Beh avior.java:225)
at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehav iors(Sandbox.java:70)
at edu.cmu.cs.stage3.alice.core.World.scheduleBehavio rs(World.java:444)
at edu.cmu.cs.stage3.alice.core.World.schedule(World. java:486)
at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.sc hedule(DefaultClock.java:94)
at edu.cmu.cs.stage3.alice.authoringtool.AuthoringToo l$11.run(AuthoringTool.java:689)
at edu.cmu.cs.stage3.alice.authoringtool.util.Default Scheduler.simulateOnce(DefaultScheduler.java:115)
at edu.cmu.cs.stage3.alice.authoringtool.util.Default Scheduler.run(DefaultScheduler.java:76)
at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run( AbstractScheduler.java:45)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:189)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 478)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
at java.awt.Dialog$1.run(Dialog.java:542)
at java.awt.Dialog$3.run(Dialog.java:569)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:567)
at java.awt.Component.show(Component.java:1133)
at java.awt.Component.setVisible(Component.java:1088)
at edu.cmu.cs.stage3.swing.DialogManager.showModalDia log(DialogManager.java:58)
at edu.cmu.cs.stage3.swing.DialogManager.showDialog(D ialogManager.java:123)
at edu.cmu.cs.stage3.alice.authoringtool.AuthoringToo l.play(AuthoringTool.java:5087)
at edu.cmu.cs.stage3.alice.authoringtool.Actions$15.a ctionPerformed(Actions.java:167)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1819)
at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(AbstractButton.java:1872)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:247)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEven tMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.jav a:5166)
at java.awt.Component.processEvent(Component.java:496 3)
at java.awt.Container.processEvent(Container.java:161 3)
at java.awt.Component.dispatchEventImpl(Component.jav a:3681)
at java.awt.Container.dispatchEventImpl(Container.jav a:1671)
at java.awt.Component.dispatchEvent(Component.java:35 43)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:3527)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3242)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3172)
at java.awt.Container.dispatchEventImpl(Container.jav a:1657)
at java.awt.Window.dispatchEventImpl(Window.java:1606 )
at java.awt.Component.dispatchEvent(Component.java:35 43)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 480)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:100)
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 07-18-2008, 09:20 AM

That is an error that has been discussed elsewhere in the forum, particularly with respect to the walk method, and some work around examples are posted. As you note, the problem has not been fixed in ver. 2.2.

What the basic problem is is that when the event while condition goes false, any running methods are stopped - but at an indeterminated time. This can leave the loop index in an undetermined state, causing the error message you listed.

Dick Baldwin has posted a better explaination, but it may take a bit of searching to find. As I recall, Alice in it's current version does not follow the Java guidelines for multi-threaded code execution.
   
Reply With Quote
Workaround for the do-together bug
Old
groucho
Guest
 
Status:
Posts: n/a
Default Workaround for the do-together bug - 07-18-2008, 10:12 AM

Well, I'm not sure whether the OP is looking for a workaround or simple wants to point to the still existing bug in 2.2. In any case, I found the enclosed workaround to work quite well for practical purposes.
Attached Files
File Type: a2w buggyWorkAround.a2w (1.11 MB, 102 views)
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.