Giter VIP home page Giter VIP logo

iotedgehubdev's Introduction

Azure IoT EdgeHub Dev Tool Build Status

Announcement

The Azure IoT EdgeHub Dev Tool is in a maintenance mode. Please see this announcement for more details. We recommend using VM, Physical devices or EFLOW.

Introduction

The Azure IoT EdgeHub Dev Tool provides a local development experience with a simulator for creating, developing, testing, running, and debugging Azure IoT Edge modules and solutions.

The simulator allows you to run, test and debug your own custom IoT Edge modules locally, without the IoT Edge Runtime, and with the following benefits:

  • Your custom Edge module code is the same whether running on the simulator or the full IoT Edge Runtime.
  • Your Edge solution can be run locally without the need to push new images or create IoT Edge deployment manifests.
  • The only credential required to run your Edge solution on the simulator is the IoT Edge Device Connection String. The IoT Hub Connection String is not needed.
  • It helps you debug your custom Edge modules on the host and not just in the container.

The following table compares the requirements to run your solution on the IoT Edge Runtime and iotedgehubdev tool:

IoT Edge Runtime iotedgehubdev
Device Credential Needed YES YES
IoT Hub Credential Needed YES NO
Build Image YES YES
Push Image YES NO
Create Deployment YES NO
Support native debug scenario NO YES

Installing

  1. Install Docker CE (18.02.0+) on Windows, macOS or Linux

  2. Install Docker Compose (1.20.0+) (Linux only. Compose has already been included in Windows/macOS Docker CE installation)

  3. Install Python (3.5/3.6/3.7/3.8/3.9) and Pip

  4. Install iotedgehubdev by running the following command in your terminal:

    pip install --upgrade iotedgehubdev
    
  5. Ensure the user is a member of docker user group (Linux / MacOS only):

    sudo usermod -aG docker $USER
    

Please make sure there is no Azure IoT Edge runtime running on the same machine as iotedgehubdev since they require the same ports.

Quickstart

1. Setup

iotedgehubdev setup -c "<edge-device-connection-string>"

2. Start/Stop an IoT Edge solution in simulator

iotedgehubdev start -d <path/to/deployment-manifest>
iotedgehubdev stop

3. Start and debug a single module natively

  1. Start the module with specific input(s) and/or environment variable(s)

    iotedgehubdev start -i "<module-inputs>"
    
    // OR
    
    iotedgehubdev start -i "<module-inputs>" -e "<environment-variable>"
    

    For example:
    iotedgehubdev start -i "input1,input2" -e "TestEnv1=Value1" -e "TestEnv2=Value2"

  2. Output the module credential environment variables

    iotedgehubdev modulecred
    
  3. Start your module natively with the environment variables from the previous step

  4. Send a message to your module through the RESTful API

    For example:
    curl --header "Content-Type: application/json" --request POST --data '{"inputName": "input1","data": "hello world"}' http://localhost:53000/api/v1/messages

  5. Stop the simulator

    iotedgehubdev stop
    

Other resources

Data/Telemetry

This project collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can change your telemetry settings by updating collect_telemetry to no in the ini file.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

iotedgehubdev's People

Contributors

adashen avatar blackchoey avatar cindydeng1998 avatar konichi3 avatar lazarusx avatar marianan avatar mhshami01 avatar microsoftopensource avatar msftgits avatar sldragon avatar smcd253 avatar vikas0212git avatar w12379564 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iotedgehubdev's Issues

[Windows container] debug csharp module failed

repro on :
windows10
docker * windows container
Csharp local module testing

test case : Start edgehub for local module testing (csharp)
Run “Iotedgehubdev modulecred”
Copy the output env to the csharp launch debug configuration in vscode
Run “iotedgehubdev start -i ”
Make sure it is successfully started and “curl” message shows up
In vscode F5 to start the debugger.
verify the error in screenshot.

image
docker logs edgeHubDev
image

Permission denied issue when run iotedgehubdev command on Mac

VSCs-Mac-mini:/ vsc$ iotedgehubdev setup -c 'HostName=v-czg-hub0710.azure-devices.net;DeviceId=iotedgemac;SharedAccessKey=XgltMM+bFr3/rj7aac+A0dJ1zokN2J1gPJrM3c9WtK8='

ERROR: Error: [Errno 1] Operation not permitted: '/private/var/lib/iotedgehubdev/certs/edge-device-ca/private'

VSCs-Mac-mini:/ vsc$ iotedgehubdev modulecred

ERROR: Error: [Errno 13] Permission denied: '/etc/iotedgehubdev/edgehub.json'.

iotedgehubdev start -d failed for large createOptions on Mac

(py37) VSCs-Mac-mini:iotedgehubdevtest vsc$ sudo iotedgehubdev start -d "/Users/vsc/Documents/ChenTest/1030/EdgeSolutionCsharp/config/deployment.json" -v
Network azure-iot-edge-dev is external, skipping
ERROR: Error: the JSON object must be str, bytes or bytearray, not dict

sudo which iotedgehubdev start -d "/Users/vsc/Documents/ChenTest/1030/EdgeSolutionCsharp/config/deployment.json" -v

VSCs-Mac-mini:~ vsc$ sudo which iotedgehubdev start -d "/Users/vsc/Documents/ChenTest/1030/EdgeSolutionCsharp/config/deployment.json" -v
Password:
Network azure-iot-edge-dev is external, skipping
ERROR: Error: expected string or buffer
VSCs-Mac-mini:~ vsc$ 

Edge Hub Dev stops functioning after processing only a few messages

I've encountered an issue where edge hub dev stops processing messages after only a few +200K sized messages. It appears to be related to module re-authentication.

I have deleted the original edge device in the portal, and recreated a new device and the problem persists. Also tried both AMQP and MQTT protocols. Error message appears to perhaps indicate an auth failure from the edge sim to IoT Hub.

See log stack below:

[2018-10-30 04:45:35 : Starting Edge Hub
[10/30/2018 04:45:36.007 AM] Edge Hub Main()
2018-10-30 04:45:39.012 +00:00 [INF] - Created persistent store at /tmp/edgeHub
2018-10-30 04:45:39.124 +00:00 [INF] - Created device scope identities cache
2018-10-30 04:45:39.145 +00:00 [INF] - Starting Edge Hub
2018-10-30 04:45:39.147 +00:00 [INF] - Version - 1.0.3.17521421 (1ccb9b0728cd046f89a7d6eb0af000b3cbd7bb6a)
2018-10-30 04:45:39.148 +00:00 [INF] -
        █████╗ ███████╗██╗   ██╗██████╗ ███████╗
       ██╔══██╗╚══███╔╝██║   ██║██╔══██╗██╔════╝
       ███████║  ███╔╝ ██║   ██║██████╔╝█████╗
       ██╔══██║ ███╔╝  ██║   ██║██╔══██╗██╔══╝
       ██║  ██║███████╗╚██████╔╝██║  ██║███████╗
       ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝

 ██╗ ██████╗ ████████╗    ███████╗██████╗  ██████╗ ███████╗
 ██║██╔═══██╗╚══██╔══╝    ██╔════╝██╔══██╗██╔════╝ ██╔════╝
 ██║██║   ██║   ██║       █████╗  ██║  ██║██║  ███╗█████╗
 ██║██║   ██║   ██║       ██╔══╝  ██║  ██║██║   ██║██╔══╝
 ██║╚██████╔╝   ██║       ███████╗██████╔╝╚██████╔╝███████╗
 ╚═╝ ╚═════╝    ╚═╝       ╚══════╝╚═════╝  ╚═════╝ ╚══════╝

2018-10-30 04:45:39.148 +00:00 [INF] - Installing intermediate certificates.
2018-10-30 04:45:39.226 +00:00 [INF] - Starting refresh of device scope identities cache
2018-10-30 04:45:39.329 +00:00 [INF] - Started task to cleanup processed and stale messages
2018-10-30 04:45:39.336 +00:00 [INF] - Created new message store
2018-10-30 04:45:39.770 +00:00 [INF] - Initializing configuration
2018-10-30 04:45:40.512 +00:00 [WRN] - Encountered an error while refreshing the device scope identities cache. Will retry the operation in some time...
2018-10-30 04:45:40.774 +00:00 [INF] - Set the following 2 route(s) in edge hub
2018-10-30 04:45:40.777 +00:00 [INF] - r1: FROM /messages/modules/ReaderModule/outputs/output1 INTO BrokeredEndpoint("/modules/MlModule/inputs/amlInput")
2018-10-30 04:45:40.777 +00:00 [INF] - r2: FROM /messages/modules/MlModule/outputs/amlOutput INTO BrokeredEndpoint("/modules/WebAppModule/inputs/input1")
2018-10-30 04:45:40.779 +00:00 [INF] - Updated message store TTL to -1 seconds
2018-10-30 04:45:40.779 +00:00 [INF] - Updated the edge hub store and forward configuration
2018-10-30 04:45:40.781 +00:00 [INF] - Initialized edge hub configuration
2018-10-30 04:45:40.835 +00:00 [INF] - Starting timer to authenticate connections with a period of 300 seconds
2018-10-30 04:45:41.146 +00:00 [INF] - Starting protocol heads - (MQTT, AMQP, HTTP)
2018-10-30 04:45:41.164 +00:00 [INF] - Starting MQTT head
2018-10-30 04:45:41.360 +00:00 [INF] - Initializing TLS endpoint on port 8883 for MQTT head.
2018-10-30 04:45:41.439 +00:00 [INF] - Starting AMQP head
2018-10-30 04:45:41.467 +00:00 [INF] - Started MQTT head
2018-10-30 04:45:41.610 +00:00 [INF] - Started AMQP head
2018-10-30 04:45:41.615 +00:00 [INF] - Starting HTTP head
2018-10-30 04:45:41.747 +00:00 [INF] - User profile is available. Using '"/home/edgehubuser/.aspnet/DataProtection-Keys"' as key repository; keys will not be encrypted at rest.
2018-10-30 04:45:41.784 +00:00 [INF] - Creating key {7ee08d8b-c4db-48bc-8422-9f344fc958aa} with creation date 2018-10-30 04:45:41Z, activation date 2018-10-30 04:45:41Z, and expiration date 2019-01-28 04:45:41Z.
2018-10-30 04:45:41.800 +00:00 [WRN] - No XML encryptor configured. Key {7ee08d8b-c4db-48bc-8422-9f344fc958aa} may be persisted to storage in unencrypted form.
2018-10-30 04:45:41.805 +00:00 [INF] - Writing data to file '"/home/edgehubuser/.aspnet/DataProtection-Keys/key-7ee08d8b-c4db-48bc-8422-9f344fc958aa.xml"'.
2018-10-30 04:45:42.338 +00:00 [WRN] - Overriding address(es) '"http://+:80"'. Binding to endpoints defined in "UseKestrel()" instead.
2018-10-30 04:45:42.396 +00:00 [INF] - Started HTTP head
2018-10-30 04:45:43.091 +00:00 [INF] - New token received on the Cbs link
2018-10-30 04:45:44.278 +00:00 [WRN] - Error while refreshing the service identity for container/ReaderModule
Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiException: Message: Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized, Content: {"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:3032dda4197c48129087d94620f631a1-G:3-TimeStamp:10/30/2018 04:45:44"}
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScope(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 115
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScopeWithRetry(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 85
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.ServiceProxy.GetServiceIdentity(String deviceId, String moduleId) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/ServiceProxy.cs:line 77
   at Microsoft.Azure.Devices.Edge.Hub.Core.DeviceScopeIdentitiesCache.RefreshServiceIdentity(String id) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs:line 140
2018-10-30 04:45:44.368 +00:00 [INF] - Attempting to connect to IoT Hub for client container/ReaderModule via AMQP...
2018-10-30 04:45:44.398 +00:00 [INF] - Created cloud proxy for client container/ReaderModule via AMQP, with client operation timeout 20000.
2018-10-30 04:45:44.406 +00:00 [INF] - Initialized cloud proxy 4e4900cb-86d9-4c24-b12c-dbda0ae5f694 for container/ReaderModule
2018-10-30 04:45:44.408 +00:00 [INF] - Created cloud connection for client container/ReaderModule
2018-10-30 04:45:44.410 +00:00 [INF] - New cloud connection created for device container/ReaderModule
2018-10-30 04:45:44.891 +00:00 [INF] - New token received on the Cbs link
2018-10-30 04:45:45.059 +00:00 [INF] - New token requested by client container/ReaderModule, but using existing token as it is usable.
2018-10-30 04:45:45.345 +00:00 [WRN] - Error while refreshing the service identity for container/WebAppModule
Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiException: Message: Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized, Content: {"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:f1d173c145104b64a8dd400f121ed1c4-G:2-TimeStamp:10/30/2018 04:45:45"}
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScope(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 115
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScopeWithRetry(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 85
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.ServiceProxy.GetServiceIdentity(String deviceId, String moduleId) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/ServiceProxy.cs:line 77
   at Microsoft.Azure.Devices.Edge.Hub.Core.DeviceScopeIdentitiesCache.RefreshServiceIdentity(String id) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs:line 140
2018-10-30 04:45:45.348 +00:00 [INF] - Attempting to connect to IoT Hub for client container/WebAppModule via AMQP...
2018-10-30 04:45:45.349 +00:00 [INF] - Created cloud proxy for client container/WebAppModule via AMQP, with client operation timeout 20000.
2018-10-30 04:45:45.349 +00:00 [INF] - Initialized cloud proxy 7befd60f-6ddf-4843-a834-b8dfebffabc5 for container/WebAppModule
2018-10-30 04:45:45.349 +00:00 [INF] - Created cloud connection for client container/WebAppModule
2018-10-30 04:45:45.349 +00:00 [INF] - New cloud connection created for device container/WebAppModule
2018-10-30 04:45:45.352 +00:00 [INF] - New token requested by client container/WebAppModule, but using existing token as it is usable.
2018-10-30 04:45:45.531 +00:00 [INF] - Exiting disconnected state
2018-10-30 04:45:45.534 +00:00 [INF] - Cloud connection for container/ReaderModule is True
2018-10-30 04:45:45.553 +00:00 [INF] - Connection status for container/ReaderModule changed to ConnectionEstablished
2018-10-30 04:45:45.570 +00:00 [INF] - Processing subscriptions for client container/ReaderModule.
2018-10-30 04:45:45.618 +00:00 [INF] - Cloud connection for container/WebAppModule is True
2018-10-30 04:45:45.618 +00:00 [INF] - Connection status for container/WebAppModule changed to ConnectionEstablished
2018-10-30 04:45:45.618 +00:00 [INF] - Processing subscriptions for client container/WebAppModule.
2018-10-30 04:45:45.625 +00:00 [INF] - Entering connected state
2018-10-30 04:45:45.642 +00:00 [INF] - Authenticated container/WebAppModule with IotHub
2018-10-30 04:45:45.655 +00:00 [INF] - Token updated for container/WebAppModule
2018-10-30 04:45:45.775 +00:00 [INF] - Authenticated container/ReaderModule with IotHub
2018-10-30 04:45:45.776 +00:00 [INF] - Token updated for container/ReaderModule
2018-10-30 04:45:46.007 +00:00 [INF] - New device connection for device container/WebAppModule
2018-10-30 04:45:46.013 +00:00 [INF] - Bind device proxy for device container/WebAppModule
2018-10-30 04:45:46.017 +00:00 [INF] - Initialized AMQP connection handler for container/WebAppModule
2018-10-30 04:45:46.025 +00:00 [INF] - New device connection for device container/ReaderModule
2018-10-30 04:45:46.034 +00:00 [INF] - Bind device proxy for device container/ReaderModule
2018-10-30 04:45:46.036 +00:00 [INF] - Initialized AMQP connection handler for container/ReaderModule
2018-10-30 04:45:46.053 +00:00 [INF] - Opened link Events for container/WebAppModule
2018-10-30 04:45:46.065 +00:00 [INF] - Opened link Events for container/ReaderModule
2018-10-30 04:45:46.282 +00:00 [INF] - Processing subscription ModuleMessages for client container/WebAppModule.
2018-10-30 04:45:46.297 +00:00 [INF] - Opened link ModuleMessages for container/WebAppModule
2018-10-30 04:45:52.389 +00:00 [WRN] - Error while refreshing the service identity for container/MlModule
Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiException: Message: Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized, Content: {"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:1e322d33999546debe58792b72501053-G:3-TimeStamp:10/30/2018 04:45:52"}
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScope(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 115
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScopeWithRetry(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 85
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.ServiceProxy.GetServiceIdentity(String deviceId, String moduleId) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/ServiceProxy.cs:line 77
   at Microsoft.Azure.Devices.Edge.Hub.Core.DeviceScopeIdentitiesCache.RefreshServiceIdentity(String id) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs:line 140
2018-10-30 04:45:52.391 +00:00 [INF] - Attempting to connect to IoT Hub for client container/MlModule via AMQP...
2018-10-30 04:45:52.391 +00:00 [INF] - Created cloud proxy for client container/MlModule via AMQP, with client operation timeout 20000.
2018-10-30 04:45:52.392 +00:00 [INF] - Initialized cloud proxy e764b06f-5b13-4414-bb7b-ffee489a6acb for container/MlModule
2018-10-30 04:45:52.392 +00:00 [INF] - Created cloud connection for client container/MlModule
2018-10-30 04:45:52.393 +00:00 [INF] - New cloud connection created for device container/MlModule
2018-10-30 04:45:52.393 +00:00 [INF] - New token requested by client container/MlModule, but using existing token as it is usable.
2018-10-30 04:45:52.473 +00:00 [INF] - Cloud connection for container/MlModule is True
2018-10-30 04:45:52.473 +00:00 [INF] - Connection status for container/MlModule changed to ConnectionEstablished
2018-10-30 04:45:52.473 +00:00 [INF] - Processing subscriptions for client container/MlModule.
2018-10-30 04:45:52.473 +00:00 [INF] - Authenticated container/MlModule with IotHub
2018-10-30 04:45:52.479 +00:00 [INF] - Successfully generated identity for clientId container/MlModule and username {host}/container/MlModule/?api-version=2017-11-08-preview&DeviceClientType=Microsoft.Azure.Devices.Client%2F1.17.0-preview-010%20%28.NET%20Core%204.6.0.0%3B%20Linux%204.9.93-linuxkit-aufs%20%231%20SMP%20Wed%20Jun%206%2016%3A55%3A56%20UTC%202018%3B%20X64%29
2018-10-30 04:45:52.487 +00:00 [INF] - ClientAuthenticated, container/MlModule, 3faa42f7
2018-10-30 04:45:52.573 +00:00 [INF] - New device connection for device container/MlModule
2018-10-30 04:45:52.574 +00:00 [INF] - Bind device proxy for device container/MlModule
2018-10-30 04:45:52.577 +00:00 [INF] - Binding message channel for device Id container/MlModule
2018-10-30 04:45:53.445 +00:00 [INF] - Processing subscription TwinResponse for client container/MlModule.
2018-10-30 04:45:53.705 +00:00 [INF] - Set subscriptions from session state for container/MlModule
2018-10-30 04:45:54.905 +00:00 [INF] - Processing subscription TwinResponse for client container/MlModule.
2018-10-30 04:45:54.906 +00:00 [INF] - Processing subscription ModuleMessages for client container/MlModule.
2018-10-30 04:45:54.907 +00:00 [INF] - Set subscriptions from session state for container/MlModule
2018-10-30 04:50:41.168 +00:00 [INF] - Reauthenticating connected clients

Multiple connections detected for device {name/module} causing lost ACKs

Using: iotedgehubdev, version 0.5.0

This may be related to issue #100 ... but it appears that the simulator Edge Hub is having issues is having troubles with multiple module routes. The configuration for the edge runtime routing is as follows given modules A, B, C:

A.Output1 -> B.Input1
B.Output1 -> C.Input1
C.Output2 -> A.Input2 (these are flow control messages that happen only very occasionally)

2018-11-03 18:11:43.902 +00:00 [INF] - New token received on the Cbs link
2018-11-03 18:11:43.903 +00:00 [INF] - Client edge/WebAppModule in device scope authenticated locally.
2018-11-03 18:11:43.903 +00:00 [INF] - Token updated for edge/WebAppModule
2018-11-03 18:11:43.912 +00:00 [INF] - New device connection for device edge/WebAppModule
2018-11-03 18:11:43.913 +00:00 [INF] - Closing AMQP device proxy for edge/WebAppModule because no handler was registered.
Microsoft.Azure.Devices.Edge.Hub.Core.MultipleConnectionsException: Multiple connections detected for device edge/WebAppModule
2018-11-03 18:11:43.917 +00:00 [INF] - Closing link ModuleMessages for edge/WebAppModule
2018-11-03 18:11:43.928 +00:00 [INF] - Bind device proxy for device edge/WebAppModule
2018-11-03 18:11:43.928 +00:00 [INF] - Initialized AMQP connection handler for edge/WebAppModule
2018-11-03 18:11:43.929 +00:00 [INF] - Opened link Events for edge/WebAppModule
2018-11-03 18:11:45.595 +00:00 [WRN] - Unable to send message to edge/WebAppModule because ModuleMessages link was not found.
2018-11-03 18:12:15.592 +00:00 [WRN] - Did not receive ack for message c855a408-3cab-4ef6-a7d1-a71ea03805b0 from device/module edge/WebAppModule
2018-11-03 18:12:15.596 +00:00 [WRN] - Error sending messages to module edge/WebAppModule
System.TimeoutException: Message completion response not received
   at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 266
   at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 99
2018-11-03 18:12:16.712 +00:00 [WRN] - Unable to send message to edge/WebAppModule because ModuleMessages link was not found.
2018-11-03 18:12:46.710 +00:00 [WRN] - Did not receive ack for message eea78cbc-e2a5-4153-8c91-cde24ef54292 from device/module edge/WebAppModule
2018-11-03 18:12:46.710 +00:00 [WRN] - Error sending messages to module edge/WebAppModule
System.TimeoutException: Message completion response not received
   at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 266
   at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 99
2018-11-03 18:12:48.616 +00:00 [WRN] - Unable to send message to edge/WebAppModule because ModuleMessages link was not found.
2018-11-03 18:13:18.629 +00:00 [WRN] - Did not receive ack for message a3ab05aa-51cf-4ddf-800b-b147a6e14731 from device/module edge/WebAppModule
2018-11-03 18:13:18.629 +00:00 [WRN] - Error sending messages to module edge/WebAppModule
System.TimeoutException: Message completion response not received
   at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 266
   at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 99
2018-11-03 18:13:22.707 +00:00 [WRN] - Unable to send message to edge/WebAppModule because ModuleMessages link was not found.
2018-11-03 18:13:52.710 +00:00 [WRN] - Did not receive ack for message a97ec3a6-efe7-4c67-9e51-afd4bbf83b79 from device/module edge/WebAppModule
2018-11-03 18:13:52.711 +00:00 [WRN] - Error sending messages to module edge/WebAppModule
System.TimeoutException: Message completion response not received
   at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 266
   at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 99

When to use --remove-orphans flag

When I run the follow command:

PS C:\Users\dagk> iotedgehubdev stop
WARNING: Found orphan containers (tempSensor, SampleModule, edgeHubDev) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
IoT Edge Simulator has been stopped successfully.
PS C:\Users\dagk> iotedgehubdev stop --remove-orphans
Error: no such option: --remove-orphans

It is unclear when I really can use the flag --remove-orphans

open page 404 : https://github.com/Azure/iot-edge-testing-utility/blob/master/swagger.json

VSCs-Mac-mini:/ vsc$ sudo iotedgehubdev start -i input2
EdgeHub runtime has been started in single module mode.
Please run iotedgehubdev modulecred to get credential to connect your module.
And send message through:

    curl --header "Content-Type: application/json" --request POST --data '{"inputName": "input2","data":"hello world"}' http://localhost:53000/api/v1/messages

Please refer to https://github.com/Azure/iot-edge-testing-utility/blob/master/swagger.json for detail schema

but open page 404 for https://github.com/Azure/iot-edge-testing-utility/blob/master/swagger.json

ERROR: Error: dump_privatekey() takes no keyword arguments

Running the setup command results in the error:
ERROR: Error: dump_privatekey() takes no keyword arguments

This is using the right click in VSCode or creating the command line manually:
sudo iotedgehubdev setup -c "{iot edge connection string}"

I'm running MacOS Mojave.

Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized

step:

  1. iotedgehubdev setup -c "HostName=czghub.azure-devices.net;DeviceId=edge1015;SharedAccessKey=fb/Cf4ays3CUZS0B/1I1/eHH7D10UsnimC7IaNYpgFU="

2.iotedgehubdev start -d deployment.json

  1. see edgeHubDev logs
C:\Users\v-czg>docker logs edgeHubDev
[2018-10-15 03:54:14 : Starting Edge Hub
[10/15/2018 03:54:14.663 AM] Edge Hub Main()
2018-10-15 03:54:18.475 +00:00 [INF] - Created persistent store at /tmp/edgeHub
2018-10-15 03:54:18.521 +00:00 [INF] - Created device scope identities cache
2018-10-15 03:54:18.525 +00:00 [INF] - Starting refresh of device scope identities cache
2018-10-15 03:54:18.529 +00:00 [INF] - Starting Edge Hub
2018-10-15 03:54:18.530 +00:00 [INF] - Version - 1.0.3.17521421 (1ccb9b0728cd046f89a7d6eb0af000b3cbd7bb6a)
2018-10-15 03:54:18.531 +00:00 [INF] -
        █████╗ ███████╗██╗   ██╗██████╗ ███████╗
       ██╔══██╗╚══███╔╝██║   ██║██╔══██╗██╔════╝
       ███████║  ███╔╝ ██║   ██║██████╔╝█████╗
       ██╔══██║ ███╔╝  ██║   ██║██╔══██╗██╔══╝
       ██║  ██║███████╗╚██████╔╝██║  ██║███████╗
       ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝

██╗ ██████╗ ████████╗    ███████╗██████╗  ██████╗ ███████╗
██║██╔═══██╗╚══██╔══╝    ██╔════╝██╔══██╗██╔════╝ ██╔════╝
██║██║   ██║   ██║       █████╗  ██║  ██║██║  ███╗█████╗
██║██║   ██║   ██║       ██╔══╝  ██║  ██║██║   ██║██╔══╝
██║╚██████╔╝   ██║       ███████╗██████╔╝╚██████╔╝███████╗
╚═╝ ╚═════╝    ╚═╝       ╚══════╝╚═════╝  ╚═════╝ ╚══════╝

2018-10-15 03:54:18.531 +00:00 [INF] - Installing intermediate certificates.
2018-10-15 03:54:18.621 +00:00 [INF] - Started task to cleanup processed and stale messages
2018-10-15 03:54:18.621 +00:00 [INF] - Created new message store
2018-10-15 03:54:18.793 +00:00 [INF] - Initializing configuration
2018-10-15 03:54:19.832 +00:00 [INF] - Set the following 2 route(s) in edge hub
2018-10-15 03:54:19.834 +00:00 [INF] - r1: FROM /messages/modules/SampleModule/outputs/* INTO $upstream
2018-10-15 03:54:19.834 +00:00 [INF] - r2: FROM /messages/modules/tempSensor/outputs/temperatureOutput INTO BrokeredEndpoint("/modules/SampleModule/inputs/input1")
2018-10-15 03:54:19.835 +00:00 [INF] - Updated message store TTL to -1 seconds
2018-10-15 03:54:19.836 +00:00 [INF] - Updated the edge hub store and forward configuration
2018-10-15 03:54:19.836 +00:00 [INF] - Initialized edge hub configuration
2018-10-15 03:54:19.856 +00:00 [INF] - Starting timer to authenticate connections with a period of 300 seconds
2018-10-15 03:54:20.454 +00:00 [INF] - Starting protocol heads - (MQTT, AMQP, HTTP)
2018-10-15 03:54:20.473 +00:00 [INF] - Starting MQTT head
2018-10-15 03:54:20.503 +00:00 [WRN] - Encountered an error while refreshing the device scope identities cache. Will retry the operation in some time...
2018-10-15 03:54:20.648 +00:00 [INF] - Initializing TLS endpoint on port 8883 for MQTT head.
2018-10-15 03:54:20.732 +00:00 [INF] - Starting AMQP head
2018-10-15 03:54:20.755 +00:00 [INF] - Started MQTT head
2018-10-15 03:54:20.854 +00:00 [INF] - Started AMQP head
2018-10-15 03:54:20.857 +00:00 [INF] - Starting HTTP head
2018-10-15 03:54:20.985 +00:00 [INF] - User profile is available. Using '"/home/edgehubuser/.aspnet/DataProtection-Keys"' as key repository; keys will not be encrypted at rest.
2018-10-15 03:54:21.020 +00:00 [INF] - Creating key {4830c683-49d8-43e3-89c9-2c0c597196ea} with creation date 2018-10-15 03:54:21Z, activation date 2018-10-15 03:54:20Z, and expiration date 2019-01-13 03:54:20Z.
2018-10-15 03:54:21.037 +00:00 [WRN] - No XML encryptor configured. Key {4830c683-49d8-43e3-89c9-2c0c597196ea} may be persisted to storage in unencrypted form.
2018-10-15 03:54:21.043 +00:00 [INF] - Writing data to file '"/home/edgehubuser/.aspnet/DataProtection-Keys/key-4830c683-49d8-43e3-89c9-2c0c597196ea.xml"'.
2018-10-15 03:54:21.771 +00:00 [WRN] - Overriding address(es) '"http://+:80"'. Binding to endpoints defined in "UseKestrel()" instead.
2018-10-15 03:54:21.859 +00:00 [INF] - Started HTTP head
2018-10-15 03:54:22.247 +00:00 [INF] - New token received on the Cbs link
2018-10-15 03:54:22.343 +00:00 [INF] - New token received on the Cbs link
2018-10-15 03:54:24.107 +00:00 [WRN] - Error while refreshing the service identity for edge1015/SampleModule
Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiException: Message: Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized, Content: {"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:d00a90ecec3b460e88a8067e8026e4d6-G:7-TimeStamp:10/15/2018 03:54:24"}
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScope(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 115
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScopeWithRetry(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 85
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.ServiceProxy.GetServiceIdentity(String deviceId, String moduleId) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/ServiceProxy.cs:line 77
   at Microsoft.Azure.Devices.Edge.Hub.Core.DeviceScopeIdentitiesCache.RefreshServiceIdentity(String id) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs:line 140
2018-10-15 03:54:24.176 +00:00 [INF] - Attempting to connect to IoT Hub for client edge1015/SampleModule via AMQP...
2018-10-15 03:54:24.208 +00:00 [INF] - Created cloud proxy for client edge1015/SampleModule via AMQP, with client operation timeout 20000.
2018-10-15 03:54:24.218 +00:00 [INF] - Initialized cloud proxy d892e0f1-0ad2-49bc-a91b-413e299522ef for edge1015/SampleModule
2018-10-15 03:54:24.219 +00:00 [INF] - Created cloud connection for client edge1015/SampleModule
2018-10-15 03:54:24.226 +00:00 [INF] - New cloud connection created for device edge1015/SampleModule
2018-10-15 03:54:24.717 +00:00 [WRN] - Error while refreshing the service identity for edge1015/tempSensor
Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiException: Message: Error getting device scope result from IoTHub, HttpStatusCode: Unauthorized, Content: {"Message":"ErrorCode:IotHubUnauthorizedAccess;Unauthorized","ExceptionMessage":"Tracking ID:8d08ff1144d6450680295a10d760244f-G:9-TimeStamp:10/15/2018 03:54:24"}
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScope(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 115
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.DeviceScopeApiClient.GetIdentitiesInScopeWithRetry(Uri uri) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/DeviceScopeApiClient.cs:line 85
   at Microsoft.Azure.Devices.Edge.Hub.CloudProxy.ServiceProxy.GetServiceIdentity(String deviceId, String moduleId) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.CloudProxy/ServiceProxy.cs:line 77
   at Microsoft.Azure.Devices.Edge.Hub.Core.DeviceScopeIdentitiesCache.RefreshServiceIdentity(String id) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/DeviceScopeIdentitiesCache.cs:line 140
2018-10-15 03:54:24.719 +00:00 [INF] - Attempting to connect to IoT Hub for client edge1015/tempSensor via AMQP...
2018-10-15 03:54:24.719 +00:00 [INF] - Created cloud proxy for client edge1015/tempSensor via AMQP, with client operation timeout 20000.
2018-10-15 03:54:24.719 +00:00 [INF] - Initialized cloud proxy ebe0f80c-1691-4653-a7f3-ca24b735db3b for edge1015/tempSensor
2018-10-15 03:54:24.719 +00:00 [INF] - Created cloud connection for client edge1015/tempSensor
2018-10-15 03:54:24.719 +00:00 [INF] - New cloud connection created for device edge1015/tempSensor
2018-10-15 03:54:25.903 +00:00 [INF] - New token requested by client edge1015/SampleModule, but using existing token as it is usable.
2018-10-15 03:54:25.935 +00:00 [INF] - New token requested by client edge1015/tempSensor, but using existing token as it is usable.
2018-10-15 03:54:27.207 +00:00 [INF] - Exiting disconnected state
2018-10-15 03:54:27.209 +00:00 [INF] - Cloud connection for edge1015/SampleModule is True
2018-10-15 03:54:27.217 +00:00 [INF] - Connection status for edge1015/SampleModule changed to ConnectionEstablished
2018-10-15 03:54:27.224 +00:00 [INF] - Processing subscriptions for client edge1015/SampleModule.
2018-10-15 03:54:27.247 +00:00 [INF] - Cloud connection for edge1015/tempSensor is True
2018-10-15 03:54:27.247 +00:00 [INF] - Connection status for edge1015/tempSensor changed to ConnectionEstablished
2018-10-15 03:54:27.247 +00:00 [INF] - Processing subscriptions for client edge1015/tempSensor.
2018-10-15 03:54:27.249 +00:00 [INF] - Entering connected state
2018-10-15 03:54:27.256 +00:00 [INF] - Authenticated edge1015/SampleModule with IotHub
2018-10-15 03:54:27.262 +00:00 [INF] - Token updated for edge1015/SampleModule
2018-10-15 03:54:27.361 +00:00 [INF] - Authenticated edge1015/tempSensor with IotHub
2018-10-15 03:54:27.361 +00:00 [INF] - Token updated for edge1015/tempSensor
2018-10-15 03:54:27.467 +00:00 [INF] - New device connection for device edge1015/SampleModule
2018-10-15 03:54:27.469 +00:00 [INF] - Bind device proxy for device edge1015/SampleModule
2018-10-15 03:54:27.471 +00:00 [INF] - Initialized AMQP connection handler for edge1015/SampleModule
2018-10-15 03:54:27.496 +00:00 [INF] - Opened link Events for edge1015/SampleModule
2018-10-15 03:54:27.507 +00:00 [INF] - New device connection for device edge1015/tempSensor
2018-10-15 03:54:27.508 +00:00 [INF] - Bind device proxy for device edge1015/tempSensor
2018-10-15 03:54:27.508 +00:00 [INF] - Initialized AMQP connection handler for edge1015/tempSensor
2018-10-15 03:54:27.508 +00:00 [INF] - Opened link Events for edge1015/tempSensor
2018-10-15 03:54:27.642 +00:00 [INF] - Processing subscription ModuleMessages for client edge1015/SampleModule.
2018-10-15 03:54:27.643 +00:00 [INF] - Opened link ModuleMessages for edge1015/SampleModule
2018-10-15 03:54:27.657 +00:00 [INF] - Opened link MethodReceiving for edge1015/tempSensor
2018-10-15 03:54:27.661 +00:00 [INF] - Processing subscription Methods for client edge1015/tempSensor.
2018-10-15 03:54:28.318 +00:00 [INF] - Opened link MethodSending for edge1015/tempSensor
2018-10-15 03:54:28.365 +00:00 [INF] - Processing subscription ModuleMessages for client edge1015/tempSensor.
2018-10-15 03:54:28.366 +00:00 [INF] - Opened link ModuleMessages for edge1015/tempSensor

[Windows container]invalid mount config for type "volume"

Environment:
windows10
docker * windows container

Test case: Check create options for custom volume

Run “docker volume ls” to check if volume “testVolume” exist. If exist, remove it by “docker volume rm testVolume”.
Prepare a deployment manifest (VSCode has the functionality to generate deployment manifest)
Edit deployment.json, update modules.tempSensor.settings. createOptions as "createOptions": "{"HostConfig": {"Mounts": [{"Target": "/mnt_test","Source": "testVolume","Type": "volume"}]}}"
Run “iotedgehubdev start –d <deployment.json>”
verify the result
Creating tempSensor ... error
ERROR: for tempSensor Cannot create container for service tempSensor: invalid mount config for type "volume": invalid mount path: '/mnt_test'

image
image

do we need to delete the edgehub.json when uninstall iotedgehubdev

OS: windows10

steps:

  1. pip install iotedgehubdev

  2. Iotedgehubdev setup –c "HostName=v-czghub0706.azure-devices.net;DeviceId=windowstest;SharedAccessKey=jcYNgGqzJ5mG1+NqBQIysO3y0Egjde2OueayM4UxQig="

10 days later, this v-czghub0706 iot hub is expired , then I uninstall iotedgehubdev and upgrade again

  1. pip uninstall iotedgehubdev

4.pip install --upgrade iotedgehubdev

5.open c# module solution , build and run iot edge solution in simulator

ERROR: Error: HTTPSConnectionPool(host='v-czghub0706.azure-devices.net', port=443): Max retries exceeded with url: /devices/windowstest/modules/$edgeHub?api-version=2017-11-08-preview (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003A674E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))

image

Access is denied error when debug C# module on Mac

Exception has occurred: CLR/System.AggregateException
An unhandled exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll: 'One or more errors occurred.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception 	 System.Security.Cryptography.CryptographicException : Access is denied.
   at Internal.Cryptography.Pal.StorePal.AppleTrustStore.OpenStore(StoreName storeName, StoreLocation location, OpenFlags openFlags)
   at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
   at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
   at Microsoft.Azure.Devices.Client.Edge.InstalledCertificateValidator.SetupCertificateValidation()
   at Microsoft.Azure.Devices.Client.Edge.EdgeModuleClientFactory.GetCertificateValidator(IList`1 certs)
   at Microsoft.Azure.Devices.Client.Edge.EdgeModuleClientFactory.<CreateInternalClientFromEnvironmentAsync>d__16.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at SampleModule.Program.<Init>d__3.MoveNext() in /Users/yuxianggan/Documents/test/EdgeSolution/modules/SampleModule/Program.cs:line 51

`iotedgehubdev start` stuck at `Started HTTP head` with Windows container

Version: 0.5.0rc1

(venv) PS C:\ iotedgehubdev start -d C:\path\to\deployment_.json -v
Network azure-iot-edge-dev is external, skipping
Pulling edgeHubDev ... done
Creating edgeHubDev ... done
Creating tempSensor ... done
Attaching to edgeHubDev, tempSensor
edgeHubDev    | [10/31/2018 02:27:14.753 AM] Edge Hub Main()
edgeHubDev    | 2018-10-31 10:27:16.699 +08:00 [INF] - Created persistent store at C:\Users\ContainerUser\AppData\Local\Temp\edgeHub
edgeHubDev    | 2018-10-31 10:27:16.768 +08:00 [INF] - Created device scope identities cache
edgeHubDev    | 2018-10-31 10:27:16.782 +08:00 [INF] - Starting Edge Hub
edgeHubDev    | 2018-10-31 10:27:16.784 +08:00 [INF] - Starting refresh of device scope identities cache
edgeHubDev    | 2018-10-31 10:27:16.784 +08:00 [INF] - Version - 1.0.3.17521421 (1ccb9b0728cd046f89a7d6eb0af000b3cbd7bb6a)
edgeHubDev    | 2018-10-31 10:27:16.785 +08:00 [INF] -
edgeHubDev    |         █████╗ ███████╗██╗   ██╗██████╗ ███████╗
edgeHubDev    |        ██╔══██╗╚══███╔╝██║   ██║██╔══██╗██╔════╝
edgeHubDev    |        ███████║  ███╔╝ ██║   ██║██████╔╝█████╗
edgeHubDev    |        ██╔══██║ ███╔╝  ██║   ██║██╔══██╗██╔══╝
edgeHubDev    |        ██║  ██║███████╗╚██████╔╝██║  ██║███████╗
edgeHubDev    |        ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝
edgeHubDev    |
edgeHubDev    |  ██╗ ██████╗ ████████╗    ███████╗██████╗  ██████╗
███████╗
edgeHubDev    |  ██║██╔═══██╗╚══██╔══╝    ██╔════╝██╔══██╗██╔════╝ ██╔════╝
edgeHubDev    |  ██║██║   ██║   ██║       █████╗  ██║  ██║██║  ███╗█████╗
edgeHubDev    |  ██║██║   ██║   ██║       ██╔══╝  ██║  ██║██║   ██║██╔══╝
edgeHubDev    |  ██║╚██████╔╝   ██║       ███████╗██████╔╝╚██████╔╝███
████╗
edgeHubDev    |  ╚═╝ ╚═════╝    ╚═╝       ╚══════╝╚═════╝  ╚═════╝ ╚══════╝
edgeHubDev    |
edgeHubDev    | 2018-10-31 10:27:16.785 +08:00 [INF] - Installing intermediate certificates.
edgeHubDev    | 2018-10-31 10:27:16.844 +08:00 [INF] - Created new message store
edgeHubDev    | 2018-10-31 10:27:16.851 +08:00 [INF] - Started task to cleanup processed and stale messages
edgeHubDev    | 2018-10-31 10:27:17.062 +08:00 [INF] - Initializing configuration
edgeHubDev    | 2018-10-31 10:27:17.579 +08:00 [INF] - Set the following 1 route(s) in edge hub
edgeHubDev    | 2018-10-31 10:27:17.581 +08:00 [INF] - r1: FROM /messages/modules/tempSensor/outputs/*
INTO $upstream
edgeHubDev    | 2018-10-31 10:27:17.582 +08:00 [INF] - Updated message store TTL to -1 seconds
edgeHubDev    | 2018-10-31 10:27:17.582 +08:00 [INF] - Updated the edge hub store and forward configuration
edgeHubDev    | 2018-10-31 10:27:17.583 +08:00 [INF] - Initialized edge hub configuration
edgeHubDev    | 2018-10-31 10:27:17.600 +08:00 [INF] - Starting timer to authenticate connections with
a period of 300 seconds
edgeHubDev    | 2018-10-31 10:27:17.731 +08:00 [INF] - Starting protocol heads - (MQTT, AMQP, HTTP)
edgeHubDev    | 2018-10-31 10:27:17.749 +08:00 [INF] - Starting MQTT head
edgeHubDev    | 2018-10-31 10:27:17.860 +08:00 [INF] - Initializing TLS endpoint on port 8883 for MQTT
head.
edgeHubDev    | 2018-10-31 10:27:17.953 +08:00 [INF] - Starting AMQP head
edgeHubDev    | 2018-10-31 10:27:17.972 +08:00 [INF] - Started MQTT head
edgeHubDev    | 2018-10-31 10:27:18.156 +08:00 [INF] - Started AMQP head
edgeHubDev    | 2018-10-31 10:27:18.159 +08:00 [INF] - Starting HTTP head
tempSensor    | [10/31/2018 02:27:18.245 AM] Main()
edgeHubDev    | 2018-10-31 10:27:18.309 +08:00 [INF] - User profile is available. Using '"C:\Users\ContainerUser\AppData\Local\ASP.NET\DataProtection-Keys"' as key repository and Windows DPAPI to encrypt keys at rest.
edgeHubDev    | 2018-10-31 10:27:18.345 +08:00 [INF] - Creating key {7e3c65b6-da26-4221-a05f-fa6434baf7db} with creation date 2018-10-31 02:27:18Z, activation date 2018-10-31 02:27:18Z, and expiration date
2019-01-29 02:27:18Z.
edgeHubDev    | 2018-10-31 10:27:18.396 +08:00 [INF] - Writing data to file '"C:\Users\ContainerUser\AppData\Local\ASP.NET\DataProtection-Keys\key-7e3c65b6-da26-4221-a05f-fa6434baf7db.xml"'.
tempSensor    | Using transport Amqp_Tcp_Only
edgeHubDev    | 2018-10-31 10:27:18.452 +08:00 [WRN] - Encountered an error while refreshing the device scope identities cache. Will retry the operation in some time...
edgeHubDev    | 2018-10-31 10:27:18.756 +08:00 [WRN] - Overriding address(es) '"http://+:80"'. Binding
to endpoints defined in "UseKestrel()" instead.
edgeHubDev    | 2018-10-31 10:27:18.778 +08:00 [INF] - Started HTTP head
tempSensor    | Creating ModuleClient failed with exception System.TimeoutException: Operation timeout
expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
tempSensor    | Retrying...
edgeHubDev    | 2018-10-31 10:32:17.591 +08:00 [INF] - Reauthenticating connected clients
tempSensor    | Creating ModuleClient failed with exception System.TimeoutException: Operation timeout
expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
tempSensor    | Retrying...
edgeHubDev    | 2018-10-31 10:37:17.586 +08:00 [INF] - Reauthenticating connected clients
tempSensor    | Creating ModuleClient failed with exception System.TimeoutException: Operation timeout
expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
tempSensor    | Retrying...
edgeHubDev    | 2018-10-31 10:42:17.602 +08:00 [INF] - Reauthenticating connected clients
tempSensor    | Creating ModuleClient failed with exception System.TimeoutException: Operation timeout
expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
tempSensor    | Retrying...
edgeHubDev    | 2018-10-31 10:47:17.586 +08:00 [INF] - Reauthenticating connected clients
tempSensor    | Creating ModuleClient failed with exception System.TimeoutException: Operation timeout
expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
edgeHubDev    | 2018-10-31 10:52:17.586 +08:00 [INF] - Reauthenticating connected clients
tempSensor    |
tempSensor    | Unhandled Exception: System.AggregateException: One or more errors occurred. (Operation timeout expired.) ---> System.TimeoutException: Operation timeout expired.
tempSensor    |    at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeout>b__62_2(Task t)
tempSensor    |    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
tempSensor    | --- End of stack trace from previous location where exception was thrown ---
tempSensor    |    at SimulatedTemperatureSensor.Program.InitModuleClient(TransportType transportType)
in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 100
tempSensor    |    at SimulatedTemperatureSensor.Program.MainAsync() in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 69
tempSensor    |    --- End of inner exception stack trace ---
tempSensor    |    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
tempSensor    |    at SimulatedTemperatureSensor.Program.Main() in C:\agent\_work\1\s\edge-modules\SimulatedTemperatureSensor\src\Program.cs:line 34
Gracefully stopping... (press Ctrl+C again to force)
Stopping tempSensor ... done
Stopping edgeHubDev ... done

Aborted!

[Mac]debug locale Csharp module failed

Enviroment:
Mac / ubuntu
Python2.7

test case : Start EdgeHub for local module testing (C#)
Run “Iotedgehubdev modulecred”
Copy the output env to the C# launch debug configuration in VS Code
Run “iotedgehubdev start -i ”
Make sure it is successfully started and “curl” message shows up
In VS Code F5 to start the debugger.

image

iotedgehubdev installation path is not added to PATH

I saw warnings said the installation path is not added to PATH.
Since all the iotedgehubdev operations in the test plan are executed through command line, we might need to consider add application location to PATH by default.

Error: 'environment' when iotedgehubdev start -d

step:

  1. For the edge hub set an environment variable OptimizeForPerformance to false in the deployment manifest:

"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"}]}}}"
},
"env": {
"OptimizeForPerformance": {
"value": "false"
}
}
}

  1. run iotedgehubdev start -d deployment.json
    ERROR: Error: 'environment'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.