Comments (13)
@WilliamBerryiii thanks for the tag! Bringing @nberdy and @simonporter into the fun :)
my 2cts:
- caveat emptor: even for regular devices, the
ConnectionState
property can be unreliable so it's not recommended to use this in production. TBH, we have no perfect way to surface that information right now (Ops monitoring messages could come out of order, theConnectionState
property could be out of sync...( see the end of this comment as to why) - this being said, even if i'ts unreliable, I agree with you that this field should behave the same for regular devices and edge devices.
- In theory, the SDK could "fill that gap" by querying the twin when it's an edge device and "correcting" the connection state. I don't like this idea because twin queries are throttled and that means hiding multiple REST calls behind one method call, which is generally frowned upon.
- it sounds like the idea of measuring the connection state by the establishment of the telemetry link doesn't make sense anymore: even as a regular, non-edge device, I don't necessarily open a telemetry link. I think it should rather hinge on a connection+authentication criteria (CBS/X509...) @simonporter to comment on whether we have plans or how we could fix this.
why is the ConnectionState
field unreliable?
- it relies on fully-connected protocols (MQTT and AMQP) and has no valid behavior if the device is using HTTP
- when a device is forcefully disconnected without terminating the connection, there is a timeout period during which the device is showed as connected when it really isn't
from iotedge.
@pierreca Yes, I agree that we should fix this in the service side, and I don't think the SDK should do it.
Essentially the service needs to do something like this -
- Consider a device is "connected" if any link is open on the connection (not just the events link)
- Consider an IoT Edge device to be connected if any of its modules are connected (or maybe any of the system modules).
from iotedge.
The challenge with this issue is that device connection status is not relevant to edge devices because the edge device never sends data to the cloud. It only sends data on behalf of modules and leaf devices. So one could certainly use the GetModuleAsync call on a module to determine if the module is connected.
from iotedge.
This looks like an SDK issue. Could you please open an issue https://github.com/Azure/azure-iot-sdk-csharp/issues. We'll keep this issue open until there is resolution. Thanks.
from iotedge.
The underlying issue here is that the Edge device never opens a telemetry link on behalf of the Edge device with the cloud. It only operates on behalf of modules. So the traditional approach of querying the device status would not work here. The way to monitor the connectivity of the Edge device would be to get the $edgeAgent module's twin and look at the reported properties. That should give the status of all modules running on the edge device. Hope this helps.
from iotedge.
from iotedge.
The portal uses the reported properties in the $edgeAgent's twin to print connection status.
from iotedge.
@dsajanice - should developers really be relying on the device twin connection status? We explicitly suggest in the documentation that the property should only be used in development and debugging scenarios: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-identity-registry#device-heartbeat
from iotedge.
@dsajanice - It feels then like the implementation is not aligned with the conceptual abstraction. So the root of the issue being that Edges, are seemingly not modeled as devices even though they fundamentally are - particularly from an operations perspective (which i'd guess is the use case above).
If a Device has a connection state, then so does an IoT Edge Device. So theoretical design question: "Why do I have to use a property accessor in one context (devices) and be forced to use a device twin (edge device) in another?"
cc/ @pierreca for additional perspective.
Thanks!
from iotedge.
Wouldn't it be better than to add a new ConnectionState
enum entry, that shows when the ConnectionState
is unreliable?
- When a device is connected using a protocol with a logical channel, the
ConnectionState
will show connected or disconnected. - When the last connection was made with a loose connection, the
ConnectionState
shows something likeUnreliable
- A property with the last connection Timestamp could show for both types of connections when the last connection has been established
Surely, this would be a change in every sdk and in the IoTHub itself, but wouldn't it suit all needs?
from iotedge.
I am seeing something that seems similar in terms of reporting connectivity. In VS Code, I can see that my module is sending data, in the portal I can see that it says the device is disconnected, and I can also see in the portal that the module is being reported by the device.
from iotedge.
Info: Azure/azure-iot-sdk-csharp#567 has been closed as "by design".
from iotedge.
This is unlikely to be changed anytime soon. It requires a change in how IoT Hub calculates connection status. There are no short or medium term plans to change this behavior in IoT Hub.
from iotedge.
Related Issues (20)
- edgeHub Module to Module Communication causes cleanup the Message Queue HOT 4
- iotedge check: ensure all preloaded certificates match preloaded private keys with the same ID HOT 6
- Nest edge devices - child showing 502 Bad Gateway HOT 5
- Layered deployment returns only layered desired properties. Not idempotent? HOT 7
- edgeAgent keep restarting after [ERR] - Shutting down because no response from unix:///var/run/iotedge/workload.sock for Encrypt HOT 12
- EdgeHub - TimeoutException: Message completion response not received HOT 8
- EOL update HOT 4
- How to get Azure IoT Edge device current deployment manifest file using .NET SDK? HOT 3
- Your services are very verbose in logs regardless of RuntimeLogLevel HOT 3
- Severe Vulnerabilities in Moby BuildKit and OCI runc: CVE-2024-23651, CVE-2024-23652, CVE-2024-23653, CVE-2024-21626 HOT 6
- [edge_ca] auto_generated_edge_ca_expiry_days not set in /etc/aziot/edged/config.d/00-super.toml- after following quickstart Edge CA guidelines HOT 2
- Configuration on unattained embedded devices HOT 4
- Protecting Edge (Docker) Module Images at rest with the IoT-Edge? HOT 3
- Microsoft.Azure.Devices.Edge.Agent.Edgelet.EdgeletCommunicationException HOT 3
- Unable to communicate with Edge modules (in EFLOW) from the host OS HOT 7
- Offline detection status / event HOT 4
- edgeAgent automatically stopping all modules HOT 3
- IoT Edge 1.4 install fails if system has users with UID 13622 / 13623 HOT 7
- IoT device works perfectly for days, then it does not - reboot fixes issue HOT 3
- Error getting device scope result from IoTHub (IotHubUnauthorizedAccess) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotedge.