IoT 边缘上的流分析作业不起作用,异常:System.AggregateException

Posted

技术标签:

【中文标题】IoT 边缘上的流分析作业不起作用,异常:System.AggregateException【英文标题】:Stream Analytics Job on IoT edge not working, Exception: System.AggregateException 【发布时间】:2018-10-26 14:52:22 【问题描述】:

我正在使用 https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-deploy-stream-analytics 将 ASA 作业部署到我的模拟 IoT 设备。我之前成功地将 IoT Edge 模块 (tempSensor) 部署到边缘设备,并且运行良好。我可以读取日志中的温度。

我创建了一个边缘流分析模块,指定了一个容器并将其部署在我的 IoT 边缘设备(此处:我的 Windows PC)上。每个模块的状态为“正在运行”,并且在“部署”和“由设备报告”列下选中了复选框。到现在为止还挺好。因此,如果我使用命令 iotedge list 我会得到所有正在运行的模块的列表。

但是,如果我在 Powershell docker logs IoTEdgeJob 中运行以下命令以查看 ASA 作业中的查询是否运行。我得到一个例外:

10/26/2018 14:15:59 - Module client initializing ...
10/26/2018 14:17:07 - Opened module client connection

Unhandled Exception: System.AggregateException: One or more errors occurred. (One or more errors occurred. (Operation timeout expired.)) ---> System.AggregateException: One or more errors occurred. (Operation timeout expired.) ---> System.TimeoutException: Operation timeout expired.
   at Microsoft.Azure.Devices.Client.InternalClient.<>c.<ApplyTimeoutTwin>b__64_2(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Streaming.Edge.Bindings.EdgeHubClientWrapper.GetJobDefinition() in M:\FXAGENT-001\_work\1\s\Product\Source\Edge\Bindings\Adapter\EdgeHubClientWrapper.cs:line 105
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at ASA.Container.Edge.Program.Init() in M:\FXAGENT-001\_work\1\s\Product\Source\DotNetCore\Container.App.Edge\Program.cs:line 48
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at ASA.Container.Edge.Program.Main(String[] args) in M:\FXAGENT-001\_work\1\s\Product\Source\DotNetCore\Container.App.Edge\Program.cs:line 34
10/26/2018 14:21:21 - Module client initializing ...
10/26/2018 14:21:22 - Opened module client connection
10/26/2018 14:25:31 - Module client initializing ...

一段时间后,我的 edgeHub 出现了这个错误。

我完全按照文档中的说明做了。任何想法为什么我会收到此错误?

更新 请在此链接中找到日志: https://drive.google.com/open?id=1ubUEjP17mYIvYI0aGGZHGU0JiCLUFhCS

更新 2 请在此链接中找到更新的日志: https://drive.google.com/open?id=1YNIX8XZTSRFjgnyWUkhOLFELK6bmVFa_

https://drive.google.com/open?id=11u2Y9wfZaqpC0oK85oGZ2PG_SIGkfEOv

当我尝试获取边缘流分析作业日志时,我卡在 ASA 获取路径:

11/05/2018 18:17:01 - Module client initializing ...
11/05/2018 18:17:03 - Opened module client connection
11/05/2018 18:17:03 - ASA getting path: https://phiotrawdatadev.blob.core.windows.net/asacontaineredge/ASAEdgeJobs/f1a5947d-293e-45b1-94f5-54398f96f6f1/24ba1e30-da99-4ab5-bce1-fad437e30826/ASAEdgeJobDefinition.zip?sv=2017-04-17&sr=b&sig=qHz7PUnogKQpJaTyezppHO2zXe5lrXmUX42PJjiPqac%3D&st=2018-11-05T18%3A06%3A27Z&se=2021-11-05T18%3A16%3A27Z&sp=r

UPDATE3 这里是 IoTEdgeJob(流分析)的日志 https://drive.google.com/open?id=1x0tb-6tu5X1dr8K_QEETiRwV6Git60PQ

这些也是 EdgeHub 日志的一部分

2018-11-08 15:11:43.848 +00:00 [INF] - Set subscriptions from session state for myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.913 +00:00 [INF] - Client myEdgeDevice/IoTEdgeJob in device scope authenticated locally.
2018-11-08 15:11:44.913 +00:00 [INF] - Successfully generated identity for clientId myEdgeDevice/IoTEdgeJob and username username/myEdgeDevice/IoTEdgeJob/?api-version=2018-06-30&DeviceClientType=Microsoft.Azure.Devices.Client%2F1.18.1%20%28.NET%20Core%204.6.26515.07%3B%20Linux%204.9.93-linuxkit-aufs%20%231%20SMP%20Wed%20Jun%206%2016%3A55%3A56%20UTC%202018%3B%20X64%29%20Microsoft.stream-analytics-on-iot-edge
2018-11-08 15:11:44.916 +00:00 [INF] - ClientAuthenticated, myEdgeDevice/IoTEdgeJob, 305bf5b5
2018-11-08 15:11:44.916 +00:00 [INF] - New device connection for device myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.917 +00:00 [WRN] - Closing connection for device: myEdgeDevice/IoTEdgeJob, Microsoft.Azure.Devices.Edge.Hub.Core.MultipleConnectionsException: Multiple connections detected for device myEdgeDevice/IoTEdgeJob,
2018-11-08 15:11:44.917 +00:00 [INF] - Disposing MessagingServiceClient for device Id myEdgeDevice/IoTEdgeJob because of exception - Microsoft.Azure.Devices.Edge.Hub.Core.MultipleConnectionsException: Multiple connections detected for device myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.917 +00:00 [INF] - Closing device proxy for device Id myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.917 +00:00 [INF] - Bind device proxy for device myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.917 +00:00 [INF] - Binding message channel for device Id myEdgeDevice/IoTEdgeJob
2018-11-08 15:11:44.926 +00:00 [INF] - Processing subscription TwinResponse for client myEdgeDevice/IoTEdgeJob.
2018-11-08 15:11:44.926 +00:00 [INF] - Processing subscription DesiredPropertyUpdates for client myEdgeDevice/IoTEdgeJob.

[更新 4] 流分析预览版 13 现已推出。 新日志 https://drive.google.com/open?id=1y3ioEoQaHfPxaek04HZtxRpmU1A4hoHf

【问题讨论】:

您遇到的异常是由于客户端初始化超时,这可能是由于网络问题。您能否也提供来自 edgeHub 的日志?谢谢! @Julia。我已经添加了日志。 【参考方案1】:

根据您提供的模块日志和 edgehub 日志,ASA 模块卡在获取用于作业定义的设备孪生属性。 edgehub 也有几个类似的例外。似乎模块在连接到模块双胞胎时出现问题。请检查您的端口 443、5671 和 8883 是否可以接收传出流量?

【讨论】:

我尝试与我们的网络团队合作,他们试图解决此问题。我仍然无法让流模块在 IoT Edge 上运行。我已经提供了问题中最新日志的链接。 从您的最新日志中,双连接问题似乎已解决,因为模块已获得工作 SASUrl。您能否分享您正在运行的 asa 图像(图像名称)的版本?它卡在从 blob 中获取作业。 microsoft/azureiotedge-azure-stream-analytics:1.0.0-preview012 我已经添加了来自 Stream Analytics Job 和 EdgeHub 的日志 从日志中,iotedgejob 从 blob 下载作业时遇到问题,我尝试从您附加的日志中 ping SASUrl 并得到 ContainerNotFound 异常。您能否再次检查您发布工作的容器是否仍然有效?谢谢!

以上是关于IoT 边缘上的流分析作业不起作用,异常:System.AggregateException的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Microsoft Azure IoT 中创建自定义的流数据仪表板?

比较 IOT 流的摄取时间和生成时间

物联网中心自定义规则

IoT边缘,你究竟是何方神圣?

Symfony 5 异常上的 FosRestBundle 不起作用

Windows 上的边缘计算 Azure IoT Edge for Iinux on Windows