11 Replies Latest reply on Mar 6, 2011 2:56 PM by darylducharme

    Theories create stack overflow errors


      It appears that the ways theories are implemented, they recurse to process all the combinations of values rather than iterate.  If you have even a moderately complex theory, this quickly leads to stack overflow.  Is this a known bug?  We have had to advise our developers to avoid Theories as they become ticking bombs that go off crashing the player randomly.

        • 1. Re: Theories create stack overflow errors
          mlabriola Level 4

          known issue. however, it is not that the theories are handled recursively, they iterate. it was that the dataset computation was recursive and often happended in the same frame as the rest of startup. this is resolved in the release candidate two for four dot one... sorry,for some i cant enter number in this page from my droid

          1 person found this helpful
          • 2. Re: Theories create stack overflow errors
            rdleetivo Level 1

            Thx!  Is 4.1 RC2 released?  The last entry on the blog and download page is about 4.1 RC1.  Do I have to pull RC2 directly from git?



            • 3. Re: Theories create stack overflow errors
              Simeon Bateman Level 2

              I will be assembling the rc2 - bits for us to test before release this afternoon.


              Right now to get what is the rc2 bits you would have to clone the main flexunit master, then pull in the updates from mlabriola and blegros branches.


              Otherwise you can probably check my branch later this afternoon.




              Simeon Bateman


              Principal Instigator

              PNW Rain LLC



              • 4. Re: Theories create stack overflow errors
                mlabriola Level 4

                rc one should also do the trick

                • 5. Re: Theories create stack overflow errors

                  I recently tried to use 4.1 RC2 as I switched my tests to FDT 4.2 from Flashbuilder 4. Theories seem to still be causing StackOverflow errors or sometimes it says "Token asked to send second result".


                  I've also had some other problems that I didn't have before but I'll start with that problem as that is most prevalent in my tests and I'm not sure the other errors aren't related.

                  • 6. Re: Theories create stack overflow errors
                    mlabriola Level 4

                    Any chance you can provide us any sort of test case on the Theories thing? I would really like to help on this but so far as I know this has been cleared up for everyone else reporting a problem.


                    We will be releasing 4.1 soon, so if you have other issues, I would really appreciated if you could file them at bugs.adobe.com before it it too late.




                    • 7. Re: Theories create stack overflow errors
                      darylducharme Level 1

                      Here are some files that I can consistantly get the "Token asked to send second result:" warning



                      <?xml version="1.0" encoding="utf-8"?>










                      import tests.utils.TheoryTests;


                      import org.flexunit.listeners.UIListener;

                      import org.flexunit.runner.FlexUnitCore;


                      private var core:FlexUnitCore;


                      public function runMe():void {

                      core = new FlexUnitCore();

                      core.addListener(new UIListener(uiListener));






                      <adobe:TestRunnerBase id="uiListener" width="100%" height="100%"  />



                      Test Class:

                      package tests.utils
                      import org.flexunit.experimental.theories.Theories;
                      public class TheoryTests
                      private var theory:Theories;
                      public static var numberValues:Array = [-5.0,-3.5,-1.0,0.0,1.0,2.2,3.0,4.0,5.0,6.0,7.0,8.0,9.0];
                      public function testTheory( value1:Number, value2:Number ):void {
                      // do something
                      public function testAnotherTheory( value1:Number, value2:Number ):void{
                      // do something else
                      public function testNonTheory():void{
                      // do non theory check
                      I took code out to see if it was something in my test and I was still having the problems. That's why there is no code in these tests, however that doesn't matter. I'm almost positive this is user error but I can't see it.

                      • 8. Re: Theories create stack overflow errors
                        mlabriola Level 4

                        I can run your code below without an issue on the RC.


                        After it ran correctly, I changed the number of datapoints to this:


                        public static var numberValues:Array = [-5.0,-3.5,-1.0,0.0,1.0,2.2,3.0,4.0,5.0,6.0,7.0,8.0,9.0,-5.0,-3.5,-1.0,0.0,1.0,2.2,3.0,4. 0,5.0,6.0,7.0,8.0,9.0,-5.0,-3.5,-1.0,0.0,1.0,2.2,3.0,4.0,5.0,6.0,7.0,8.0,9.0,-5.0,-3.5,-1. 0,0.0,1.0,2.2,3.0,4.0,5.0,6.0,7.0,8.0,9.0];


                        And I am still running fine.


                        Not sure if this is related to the other post, but if I do leave the is_in function in the object prototype, it does fail for me. Let me know if that is in the same project when you are testing this when you have time so I can help further.




                        • 9. Re: Theories create stack overflow errors
                          darylducharme Level 1

                          Yeah, in order to simplify and track down the bugs I got down to just one class and I am throwing the error or getting the warning every time. Mostly just the warning though.  The test class and actual class are simple too.

                          • 10. Re: Theories create stack overflow errors
                            mlabriola Level 4

                            Okay. I can't reproduce it with this information provided so far though. Is there anything else you can give me to help you?

                            • 11. Re: Theories create stack overflow errors
                              darylducharme Level 1

                              I think I may have tracked down the problem. My FDT install was using an external SWF Viewer in the debug configuration but when I switched it to the official Flash Debug Player, all seems to run fine.  Thanks for your help all around.


                              Now to rework my IS_IN functionality so I can test it without breaking things. Of course, it was a proof of concept anyway.


                              Thanks again.