monkeydo simulator app crash but not from Eclipse

I have an app that uses a background web service to download data. If I run the app on the simulator through Eclipse all is good.

If I run the app from VS Code or directly on the command line, it always crashes after the Background.Exit() command.

This is how I'm starting the app on the simulator

monkeydo.bat bin\myApp.prg edge530

My question is: how does Eclipse run the app on the simulator? Are there some magic command line options that I'm missing or are not being translated into the java command by monkeydo?

Thanks!

PS this is exactly the same prg file behaving differently. It doesn't matter if I build through Eclipse or build through monkey directly...!

  • This is a question that's hard to answer (and has come up before), but you can exactly see exactly what's being run by Eclipse if you use Process Lasso:

    https:/bitsum.com

    Set it to log process launches, and launch the sim from Eclipse.

    I see a command line like this:

    java -classpath c:\Users\USERNAME\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin\monkeybrains.jar com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux -f PROJPATH\bin\PROJNAME.prg -d fenix6spro -s SDKPATH\connectiq-sdk-win-3.2.5-2021-02-12-6d31f4357\bin\shell.exe

    monkeydo.bat looks like this:

    java -classpath "%home%monkeybrains.jar" com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux -f %prg_path% -d %device_id% -s "%home%shell.exe" %test_flag% %test_names%

    And if I look at the usage for that command (by running it without args), I see this:

    usage: MonkeyDoDeux
     -d,--device <arg>   The device to simulate
     -f,--file <arg>     The PRG file to run
     -s,--shell <arg>    The Shell executable to use to communicate to the CIQ
                         Simulator
     -t,--test <arg>     Run unit tests. Providing an optional list of space
                         separated test names will run only those tests.

    It's tough to see where extra args (or anything different with Eclipse) could come into play, unless there are undocumented args. Or unless the working directory of the command matters.

    Then again, if you only want to see the final command line of the sim (and not the intermediate launches), you could just use task manager in Windows. But Process Lasso would show you the intermediate process launches as well.

  • If you look at the console output from building there is a difference -  How java is called

    with vs code
    C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe

    with eclipse
    C:\Program Files\Java\jre1.8.0_241\bin\java

    In the settings for the vs code extention, you can set the path - I'm using the default.

    Does this make a difference?

  • That's interesting. For me, both VS Code and Eclipse use my default installed JDK, which is AdoptOpenJDK:

    C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\bin\java

    My Java path in the VS Code extension is blank (which I assume is the default).

    If you (gary_l) are seeing a similar discrepancy, maybe try installing OpenJDK?

    https://adoptopenjdk.net/

  • Thank you both for the rapid replies. I did not expect these on a Sunday! I'll have a play with the above and report back

  • What happens if you first manually start the sim?  It's in the SDK's bin directory.

  • It's the same; i'm usually starting the simulator first

  • You running the sim from the same SDK you are building with?  Not starting the 4.0 preview sim but compiling with 3.2.5 or something?

  • I don't believe so Jim...

    Interesting, I don't see a process starting from Eclipse to run the app on the simulator (even using Process Lasso above). All I see is a TCP session..

    shell.exe --transport=tcp --transport_args=127.0.0.1:1234

    If I run this directly, I can connect to the sim. Connecting to the simulator (typing ciq) stops the logging back to monkeydo and displays in this session instead. The background requests happily complete and the app continues running after each one.

    What's more if I connect to the simulator from this session after the app has "crashed", the app is still running and happily logging away and sending more requests to the server...!!!

    ciq

    So, it seems like there is something going on with the way the simulator logs back to the monkeydo java process. The simulator seems to be ok

  • I've also installed AdoptOpenJDK above but no difference :-(

  • One last update before I give up on this.... The command line debuger mdd works, but only sometimes. Mostly it times out trying to load the prg onto the simulator

    mdd --help
    usage: mdd [-d <arg>] [-e <arg>] [-h] [-x <arg>]
    -d,--device <arg>    Device to simulate
    -e,--executable <arg>CIQ executable (PRG) to debug
    -h,--help            Print help message
    -x,--debug-xml <arg> CIQ debug.xml of the provided PRG
    
    
    
    Failed to launch the app: Timeout

    There is a "set timeout" command but it doesn't seem to have been implemented. Or at least it doesn't change the timeout as per the help command

    (mdd) help set timeout
    Set timeout limit to wait for the CIQ virtual machine to respond to NUM seconds.
    Usage: set timeout NUM.

    I guess the only option here is to stick with Eclipse for this scenario