microsoft / vscode-azure-iot-edge

Azure IoT Edge for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge
Other
51 stars 36 forks source link

[windows-amd64.debug]Remote Debug Error:Connection timed out. #261

Closed czgtest closed 5 years ago

czgtest commented 6 years ago

pre-step:

  1. Please make sure to delete the 1.1.0 folder of .m2 repository on your testing machines. The path could be (C:\Users\.m2\repository\com\microsoft\azure\azure-iot-edge-archetype\1.1.0) Otherwise, the new updated package may not be installed to your local.
  2. Since the maven archetype pushed to an staging env. So please add the following to your maven “settings.xml” file under “profiles” tag https://oss.sonatype.org/content/repositories/commicrosoftazure-2618/
  3. User the pre-release vscode edge extension https://github.com/Microsoft/vscode-azure-iot-edge/releases/download/v1.4.0-rc1/azure-iot-edge-1.4.0-rc1.vsix

Test step: 1.create new IoT Edge solution : czgacr.azurecr.io/samplemodulearc 2.update deployment.template.json "image": "${MODULES.SampleModuleARC.windows-amd64.debug}", "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5005/tcp\":[{\"HostPort\":\"5005\"}]}}}" 3.Build and Push IoT edge solution

4.Run IoT Edge solution in simulator verify SampleModuleARC can receive message successfully.

5.click "SampleModuleARC Remote Debug (java)" to debug image

image

C:\Users\v-czg>docker inspect SampleModuleARC
[
    {
        "Id": "1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a",
        "Created": "2018-09-27T02:26:55.7681081Z",
        "Path": "java",
        "Args": [
            "-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n",
            "-jar",
            "./app.jar"
        ],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 3221225786,
            "Error": "",
            "StartedAt": "2018-09-27T02:27:28.7070164Z",
            "FinishedAt": "2018-09-27T11:01:25.9069914+08:00"
        },
        "Image": "sha256:d1b55c65993703b25c907e6a1dc945a78459cfce024e63972ac1c0985842c3e6",
        "ResolvConfPath": "",
        "HostnamePath": "",
        "HostsPath": "",
        "LogPath": "C:\\ProgramData\\Docker\\containers\\1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a\\1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a-json.log",
        "Name": "/SampleModuleARC",
        "RestartCount": 0,
        "Driver": "windowsfilter",
        "Platform": "windows",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "azure-iot-edge-dev",
            "PortBindings": {
                "5005/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "5005"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [],
            "CapAdd": null,
            "CapDrop": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 0,
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "hyperv",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "Mounts": [
                {
                    "Type": "volume",
                    "Source": "edgemoduledev",
                    "Target": "c:/mnt/edgemodule"
                }
            ],
            "MaskedPaths": null,
            "ReadonlyPaths": null
        },
        "GraphDriver": {
            "Data": {
                "dir": "C:\\ProgramData\\Docker\\windowsfilter\\1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a"
            },
            "Name": "windowsfilter"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "edgemoduledev",
                "Source": "C:\\ProgramData\\Docker\\volumes\\edgemoduledev\\_data",
                "Destination": "c:\\mnt\\edgemodule",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "1fb5ff59b861",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5005/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "EdgeModuleCACertificateFile=c:/mnt/edgemodule/edge-device-ca.cert.pem",
                "EdgeHubConnectionString=HostName=czghub0927.azure-devices.net;GatewayHostName=zhangchen.fareast.corp.microsoft.com;DeviceId=winedge;ModuleId=SampleModuleARC;SharedAccessKey=xReBFb1OOEM2mu3dJ7/edzzUf3DRdzmE43RnkcpfB4s=",
                "JAVA_HOME=C:\\jdk-11",
                "JAVA_VERSION=11-ea+28",
                "JAVA_URL=https://download.java.net/java/early_access/jdk11/28/GPL/openjdk-11+28_windows-x64_bin.zip",
                "JAVA_SHA256=fde3b28ca31b86a889c37528f17411cd0b9651beb6fa76cac89a223417910f4b"
            ],
            "Cmd": null,
            "ArgsEscaped": true,
            "Image": "czgacr.azurecr.io/samplemodulearc:0.0.1-windows-amd64.debug",
            "Volumes": null,
            "WorkingDir": "C:\\app",
            "Entrypoint": [
                "java",
                "-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n",
                "-jar",
                "./app.jar"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "7880e7434853b5f4289bdb139bc67d9dc29bf3a50f0a0da368af3742cfc2db85",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "data",
                "com.docker.compose.service": "SampleModuleARC",
                "com.docker.compose.version": "1.22.0",
                "iotedgehubdev": ""
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "1fb5ff59b861d583c296793bd1baa98602349cc9a5f1af0026b038df2f6ad12a",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "azure-iot-edge-dev": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "SampleModuleARC",
                        "1fb5ff59b861"
                    ],
                    "NetworkID": "821a0c1386644e31602822006200168c0274475b1affbad780d34b5cf89b9a76",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

deployment.json

{
  "modulesContent": {
    "$edgeAgent": {
      "properties.desired": {
        "schemaVersion": "1.0",
        "runtime": {
          "type": "docker",
          "settings": {
            "minDockerVersion": "v1.25",
            "loggingOptions": "",
            "registryCredentials": {
              "czgacr": {
                "username": "czgacr",
                "password": "WfjC9atR5VuV+PG8tXLIgPxoC9YK5sZX",
                "address": "czgacr.azurecr.io"
              }
            }
          }
        },
        "systemModules": {
          "edgeAgent": {
            "type": "docker",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-agent:1.0",
              "createOptions": "{}"
            }
          },
          "edgeHub": {
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-hub:1.0",
              "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}], \"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
            }
          }
        },
        "modules": {
          "tempSensor": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0",
              "createOptions": "{}"
            }
          },
          "SampleModuleARC": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "czgacr.azurecr.io/samplemodulearc:0.0.1-windows-amd64.debug",
              "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5005/tcp\":[{\"HostPort\":\"5005\"}]}}}"
            }
          }
        }
      }
    },
    "$edgeHub": {
      "properties.desired": {
        "schemaVersion": "1.0",
        "routes": {
          "SampleModuleARCToIoTHub": "FROM /messages/modules/SampleModuleARC/outputs/* INTO $upstream",
          "sensorToSampleModuleARC": "FROM /messages/modules/tempSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/SampleModuleARC/inputs/input1\")"
        },
        "storeAndForwardConfiguration": {
          "timeToLiveSecs": 7200
        }
      }
    }
  }
}

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "java",
      "name": "SampleModuleARC Local Debug (java)",
      "request": "launch",
      "cwd": "${workspaceRoot}/modules/SampleModuleARC",
      "console": "internalConsole",
      "stopOnEntry": false,
      "mainClass": "com.edgemodule.App",
      "args": "",
      "projectName": "SampleModuleARC",
      "env": {
        "EdgeHubConnectionString": "${config:azure-iot-edge.EdgeHubConnectionString}",
        "EdgeModuleCACertificateFile": "${config:azure-iot-edge.EdgeModuleCACertificateFile}"
      }
    },
    {
      "type": "java",
      "name": "SampleModuleARC Remote Debug (java)",
      "request": "attach",
      "hostName": "localhost",
      "port": 5005
    }
  ]
}
adashen commented 6 years ago

Windows docker issue, cannot expose port correctly.

adashen commented 5 years ago

@czgtest since docker is updated. Please try to verify this issue again.

czgtest commented 5 years ago

Now Java module is not support windows-amd64.debug docker file now, so close it