【问题标题】:IoT Edge runtime error 400 after starting VM which was off for 1+ months启动 VM 后 IoT Edge 运行时错误 400 已关闭 1 个月以上
【发布时间】:2021-01-19 22:37:03
【问题描述】:

我有一个在 Ubuntu 16.04 上运行 IoT Edge 1.0.10.3 的工作虚拟机,我在过去一个月左右关闭了它。

今天打开它发现:

  • 我可以正常启动所有模块。他们都报告正在运行
  • 运行时响应为:400 -- The deployment configuration is malformed or invalid
  • 运行 iotedge 检查,似乎没有任何错误
  • 当我尝试set modules 时,在 IoT 边缘模块下:There are no listed IoT Edge Modules
  • 我还在 EdgeHub 日志中收到以下错误:
<4> 2021-01-19 22:27:12.834 +00:00 [WRN] - Error getting edge hub config from twin desired properties
System.ArgumentException: schemaVersion is null or whitespace.
   at Microsoft.Azure.Devices.Edge.Util.Preconditions.CheckArgument(Boolean expression, String message) in /home/vsts/work/1/s/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Preconditions.cs:line 73
   at Microsoft.Azure.Devices.Edge.Util.Preconditions.CheckNonWhiteSpace(String value, String paramName) in /home/vsts/work/1/s/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Preconditions.cs:line 192
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.EdgeHubDesiredProperties..ctor(String schemaVersion, IDictionary`2 routes, StoreAndForwardConfiguration storeAndForwardConfiguration) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/EdgeHubDesiredProperties.cs:line 14
   at lambda_method(Closure , Object[] )
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.TwinConfigSource.GetConfigInternal() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/TwinConfigSource.cs:line 97
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.TwinConfigSource.GetConfigInternal() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/TwinConfigSource.cs:line 105

在过去一个月离线时会发生什么导致边缘进入不一致状态?

【问题讨论】:

  • 嘿VinnyH,您能否从$edgeHub 模块的模块孪生中包含所需的属性?您可以在 Azure 门户中找到它。我问是因为错误提示 schemaVersion 缺失。
  • @MatthijsvanderVeer 这里是:"properties": { "desired": { "routes": {}, "$metadata": { "$lastUpdated": "2020-11-25T18:26 :39.4780665Z", "$lastUpdatedVersion": 5, "路由": { "$lastUpdated": "2020-11-25T15:03:42.6671499Z", "$lastUpdatedVersion": 4 } }, "$version": 5 },我看到所需的属性中缺少 schemaVersion,但不确定这是如何发生的以及如何解决的想法?谢谢!

标签: azure-iot-edge


【解决方案1】:

根据docs,您的日志引用的$schemaVersion 是在1.0.10 中引入的。文档说该属性是推荐的,但运行时似乎需要它。在您的评论中,您包含了所需的属性,但缺少 $schemaVersion。尝试设置以下所需属性:

"properties":{
  "desired":{
     "routes":{},
     "schemaVersion": "1.1",
     "$metadata":{
        "$lastUpdated":"2020-11-25T18:26:39.4780665Z",
        "$lastUpdatedVersion":5,
        "routes":{
           "$lastUpdated":"2020-11-25T15:03:42.6671499Z",
           "$lastUpdatedVersion":4
        }
     }
  }
}

【讨论】:

  • 谢谢!这确实有效,但仍然质疑清单最初是如何被破坏的。另外,似乎我丢失了一个应该作为清单的一部分部署的模块,并且必须重新部署它。
  • VM 应该无法控制所需的模块,因此集线器中似乎发生了一些变化。很高兴这个答案对您有所帮助!
猜你喜欢
  • 2020-03-20
  • 1970-01-01
  • 2022-11-19
  • 1970-01-01
  • 2018-03-14
  • 2021-05-18
  • 2017-09-05
  • 1970-01-01
  • 2020-11-27
相关资源
最近更新 更多