10 Replies Latest reply on Jan 29, 2013 7:10 AM by Yennick_Trevels

    FlexUnit + AIR + Ant: flashplayer hangs




      I'm currently experiencing some issues when trying to run FlexUnit tests with Ant and AIR. The player doesn't close after the tests are finished and it's giving me the following error when I kill the player:



      D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\build.xml: 31: java.util

      client/server socket

              at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)

              at java.util.concurrent.FutureTask.get(FutureTask.java:83)

              at org.flexunit.ant.tasks.TestRun.run(Unknown Source)

              at org.flexunit.ant.tasks.FlexUnitTask.execute(Unknown Source)

              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

              at org.apache.tools.ant.Task.perform(Task.java:348)

              at org.apache.tools.ant.Target.execute(Target.java:390)

              at org.apache.tools.ant.Target.performTasks(Target.java:411)

              at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)

              at org.apache.tools.ant.Project.executeTarget(Project.java:1368)

              at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

              at org.apache.tools.ant.Project.executeTargets(Project.java:1251)

              at org.apache.tools.ant.Main.runBuild(Main.java:809)

              at org.apache.tools.ant.Main.startAnt(Main.java:217)

              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)

              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

      Caused by: could not close client/server socket

              at org.flexunit.ant.FlexUnitSocketThread.call(Unknown Source)

              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

              at java.util.concurrent.FutureTask.run(FutureTask.java:138)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(Thread.java:619)



      Total time: 25 seconds



      You can download the testproject from here which should reproduce the issue: https://docs.google.com/open?id=0BwgTrjDn2SAhSmhkWmlQbFlXQ0k

      I'm running on Windows 7 64-bit, using Flex 4.6

        • 1. Re: FlexUnit + AIR + Ant: flashplayer hangs
          Yennick_Trevels Level 2

          Anyone has any idea on this problem?

          • 2. Re: FlexUnit + AIR + Ant: flashplayer hangs
            mlabriola Level 4

            I havent had a chance to try to reproduce, however, I notice you have haltOnFailure set to false in the build.xml. Could you set it to true and see what changes?



            • 3. Re: FlexUnit + AIR + Ant: flashplayer hangs
              Yennick_Trevels Level 2

              Then I get the same problem, the flexUnit 4 adl wrapper stays open. The output shows that a test has failed, but the window doesn't close.

              I'm not sure, but could this pull request be a possible fix to this problem: https://github.com/flexunit/flexunit/pull/8 ?

              • 4. Re: FlexUnit + AIR + Ant: flashplayer hangs
                mlabriola Level 4

                Its possible. I can try to find out why it wasnt merged in before and test it with the current builds.


                You can feel free to pull from the that commit but it should really only help if something went wrong and flexunit hung. So the question is still why that is happening

                • 5. Re: FlexUnit + AIR + Ant: flashplayer hangs
                  Yennick_Trevels Level 2

                  I just build FlexUnit with the patch, but the problem remains (as expected).

                  • 6. Re: FlexUnit + AIR + Ant: flashplayer hangs
                    mlabriola Level 4



                    Can you give me AIR and SDK versions of your setup. We grabbed your demo project and all worked as expected here. Test fails, launcher closed and had no issue.



                    • 7. Re: FlexUnit + AIR + Ant: flashplayer hangs
                      Yennick_Trevels Level 2

                      Hi Michael,


                      Flex version: flex_sdk_4.6.0.23201B

                      AIR version: 3.1

                      • 8. Re: FlexUnit + AIR + Ant: flashplayer hangs
                        Yennick_Trevels Level 2

                        Here's some more logging in case this is useful:



                        [flexunit] Validating task attributes ...

                        [flexunit] Generating default values ...

                        [flexunit] Using default working dir [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project]

                        [flexunit] Using default reporting dir [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project]

                        [flexunit] Using the following settings for compilation:

                        [flexunit]     FLEX_HOME: [D:\Program files\sdks\flex_sdk_4.6.0.23201B]

                        [flexunit]     player: [air]

                        [flexunit]     sourceDirectories: ["D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\mai n\actionscript","D:\Users\

                        Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\main\locales\{l ocale}"]

                        [flexunit]     testSourceDirectories: ["D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\tes t\actionscript"]

                        [flexunit]     libraries: ["D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\libs\fl exunit-4.1.0-8-flex_4.1.0.16076.sw

                        c","D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\libs\f lexunit-aircilistener-4.1.0-8-","D:\Users\Yen

                        nick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\libs\flexunit-cilisten er-4.1.0-8-"]

                        [flexunit] Found SDK version: 4

                        [flexunit] Created test runner at [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\TestRunn er.mxml]

                        [flexunit] Compiling test classes: [org.gradlefx.flexunitexample.CalculatorTest]

                        [flexunit] Executing 'c:\Java\jdk1.6.0_20\jre\bin\java.exe' with arguments:

                        [flexunit] '-Xmx256M'

                        [flexunit] '-jar'

                        [flexunit] 'D:\Program files\sdks\flex_sdk_4.6.0.23201B\lib\mxmlc.jar'

                        [flexunit] '+flexlib'

                        [flexunit] 'D:\Program files\sdks\flex_sdk_4.6.0.23201B\frameworks'

                        [flexunit] '+configname=air'

                        [flexunit] '-output'

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\TestRunn er.swf'

                        [flexunit] '-source-path'

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\main \actionscript'

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\main \locales\{locale}'

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\src\test \actionscript'

                        [flexunit] '-library-path+=D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-p roject\libs\flexunit-4.1.0-8-flex_4.1.0.16076.swc


                        [flexunit] '-library-path+=D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-p roject\libs\flexunit-aircilistener-4.1.0-8-4.1.0.


                        [flexunit] '-library-path+=D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-p roject\libs\flexunit-cilistener-4.1.0-8-


                        [flexunit] '-debug=false'

                        [flexunit] '-headless-server=true'

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\TestRunn er.mxml'


                        [flexunit] The ' characters around the executable and arguments are

                        [flexunit] not part of the command.


                             [null] Laden van configuratiebestand D:\Program files\sdks\flex_sdk_4.6.0.23201B\frameworks\air-config.xml

                             [null] D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\TestRunne r.swf (482165 bytes)

                        [flexunit] Using the following settings for the test run:

                        [flexunit]     FLEX_HOME: [D:\Program files\sdks\flex_sdk_4.6.0.23201B]

                        [flexunit]     haltonfailure: [true]

                        [flexunit]     headless: [false]

                        [flexunit]     display: [99]

                        [flexunit]     localTrusted: [true]

                        [flexunit]     player: [air]

                        [flexunit]     command: [D:\Program files\sdks\flex_sdk_4.6.0.23201B\bin\adl.exe]

                        [flexunit]     port: [1024]

                        [flexunit]     swf: [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\TestRunn er.swf]

                        [flexunit]     timeout: [60000ms]

                        [flexunit]     toDir: [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project]

                        [flexunit] Setting up server process ...

                        [flexunit] Starting server ...

                        [flexunit] Opening server socket on port [1024].

                        [flexunit] Waiting for client connection ...

                        [flexunit] Found AIR version: 3.1

                        [flexunit] Created application descriptor at [D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\flexUnit Descriptor.xml]



                        [flexunit] Executing 'D:\Program files\sdks\flex_sdk_4.6.0.23201B\bin\adl.exe' with arguments:

                        [flexunit] 'D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\flexUnit Descriptor.xml'


                        [flexunit] The ' characters around the executable and arguments are

                        [flexunit] not part of the command.


                        [flexunit] Client connected.

                        [flexunit] Setting inbound buffer size to [262144] bytes.

                        [flexunit] Receiving data ...

                        [flexunit] Sending acknowledgement to player to start sending test data ...


                        [flexunit] FlexUnit test testSum_addingTwo_shouldReturnSum in suite org.gradlefx.flexunitexample.CalculatorTest failed.


                        [flexunit] Stopping server ...

                        [flexunit] End of test data reached, sending acknowledgement to player ...



                        BUILD FAILED

                        D:\Users\Yennick\Development\GradleFx\GradleFx-Examples\flexunit-single-project\build.xml: 31: java.util.concurrent.ExecutionException: could not close

                        client/server socket

                        • 9. Re: FlexUnit + AIR + Ant: flashplayer hangs
                          mlabriola Level 4

                          From your log, I can see that the data is reaching the java server and it is attempting to close the player.... the problem is that even using your exact same versions as you noted, it is closing correctly for me. I checked it with master and with multiple versions of FlexUnit from the build server just to be sure.


                          Literally the only thing I can see different is the directory path that is in your log files versus mine.


                          I am not 100% sure where to go from here but I am willing to help more. Thoughts?



                          • 10. Re: FlexUnit + AIR + Ant: flashplayer hangs
                            Yennick_Trevels Level 2

                            Thanks for investigating this!

                            I just tried it out on another Window 7 64-bit pc and it's also working fine there. So now that I have two devices which show a different behaviour I'll try to find the difference. I'll let you know when I find something.