4 Replies Latest reply on Sep 20, 2010 12:18 PM by bchalupka-syPD9H

    Problem with blocked native processes

    bchalupka-syPD9H

      My application relies heavily on native processes so that I am trying to implement fallback strategies if a native process doesn't work as expected.

      While creating test scenarios I had a problem with handling errors caused directly by the start() method of the NativeProcess class. It throws errors if the target process can’t be accessed or is corrupted. For example if you take an exe file in Windows that works correctly and modify it in a hex editor to corrupt it the following error is thrown:

       

      Error: Error #3219: The NativeProcess could not be started. '%1 is not a valid Win32 application.'

            at flash.desktop::NativeProcess/internalStart()

            at flash.desktop::NativeProcess/start()

       

       

      If I try to put a try-catch block around the process.start() call something unexpected happens:

      The error is cought correctly, but another error is thrown instantly:

       

      Error: Error #1503: A script failed to exit after 30 seconds and was terminated.

            at mx.managers.layoutClasses::PriorityQueue/removeSmallest()[E:\dev\4.x\frameworks\projects\ framework\src\mx\managers\layoutClasses\PriorityQueue.as:238]

            at mx.managers::LayoutManager/validateProperties()[E:\dev\4.x\frameworks\projects\framework\ src\mx\managers\LayoutManager.as:567]

            at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:730]

            at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]

       

      The problem with this error is that I got no idea how to catch or prevent it. Depending on what I do in the catch block there is another error. For example if I try to log the error I get (but sometimes not as instantly as above):

       

      Error: Error #1503: A script failed to exit after 30 seconds and was terminated.

            at mx.logging::Log$/getLogger()[E:\dev\4.x\frameworks\projects\framework\src\mx\logging\Log. as:360]

       

       

      Strange is that the error is fired instantly sometimes not after 30 seconds.

      How can I fix this?