Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Presence ping loop to fast in Debugger.cpp? #461

@doingnz

Description

@doingnz

NetMF can randomly fail to connect between MSTestSystem and NetMF system when running a long list of Unit Tests over USB.

Please see the debug trace below.

One of the reasons the two sides struggle to synchronize is possibly due to a while(true) loop in CLR_DBG_Debugger::Debugger_Discovery() which appears to blast out ping packets as fast as possible. Can see this if you add CLR_Debug::Printf( "Send presence ping....\r\n" ); just inside the while(true) {... } (which will slow things down too)

Testing is more successful (less connection errors) if a short delay is added just after sending the ping.

Thoughts?

    while(true)
    {
        CLR_Debug::Printf( "Send presence ping....\r\n" );

        CLR_EE_DBG_EVENT_BROADCAST(CLR_DBG_Commands::c_Monitor_Ping, sizeof(cmd), &cmd, WP_Flags::c_NoCaching | WP_Flags::c_NonCritical);

        Events_WaitForEvents( 0, 100 ); // give message a little time to be flushed

        // if we support soft reboot and the debugger is not stopped then we don't need to connect the debugger
        if(!CLR_EE_DBG_IS(Stopped) && ::CPU_IsSoftRebootSupported())

Debug trace

 deployed successfully
        Executing the device test..
        ERROR: System.ApplicationException: Connection failed: System.IO.IOException: Request failed
   at Microsoft.SPOT.Debugger.Request.Wait() in C:\uscom-netmf\netmf-interpreter\Framework\Debugger\WireProtocol\Engine.cs:line 309
   at Microsoft.SPOT.Debugger.Engine.SyncMessage(UInt32 cmd, UInt32 flags, Object payload, Int32 retries, Int32 timeout) in C:\uscom
-netmf\netmf-interpreter\Framework\Debugger\WireProtocol\Engine.cs:line 1445
   at Microsoft.SPOT.Debugger.Engine.SyncMessage(UInt32 cmd, UInt32 flags, Object payload) in C:\uscom-netmf\netmf-interpreter\Frame
work\Debugger\WireProtocol\Engine.cs:line 1451
   at Microsoft.SPOT.Debugger.Engine.SetExecutionMode(UInt32 iSet, UInt32 iReset, UInt32& iCurrent) in C:\uscom-netmf\netmf-interpre
ter\Framework\Debugger\WireProtocol\Engine.cs:line 1850
   at Microsoft.SPOT.Debugger.Engine.SetExecutionMode(UInt32 iSet, UInt32 iReset) in C:\uscom-netmf\netmf-interpreter\Framework\Debu
gger\WireProtocol\Engine.cs:line 1875
   at Microsoft.SPOT.Debugger.Engine.ResumeExecution() in C:\uscom-netmf\netmf-interpreter\Framework\Debugger\WireProtocol\Engine.cs
:line 1885
   at Microsoft.SPOT.Platform.Test.Harness.ConnectToDevice(String buildPath, String exePath, ArrayList referenceList) in R:\uscom-ne
tmf\netmf-interpreter\Test\Platform\Tools\MFTestSystem\Harness.cs:line 735
   at Microsoft.SPOT.Platform.Test.Harness.ConnectToDevice(String buildPath, String exePath, ArrayList referenceList) in R:\uscom-ne
tmf\netmf-interpreter\Test\Platform\Tools\MFTestSystem\Harness.cs:line 750
   at Microsoft.SPOT.Platform.Test.Harness.RunDeviceTest(String buildPath, String exeLocation, ArrayList referenceList) in R:\uscom-
netmf\netmf-interpreter\Test\Platform\Tools\MFTestSystem\Harness.cs:line 522
   at Microsoft.SPOT.Platform.Test.Harness.Run(BaseTest test, XmlLog log) in R:\uscom-netmf\netmf-interpreter\Test\Platform\Tools\MF
TestSystem\Harness.cs:line 185

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions