NodeMCU 重新启动时出现的 traceback 问题

我有一个嵌入式应用程序运行在 NodeMCU 上,由于UART被重新分配为从设备获取串行数据,所以它未连接到控制台。

在测试期间,应用程序运行了大约15个小时,然后连续重新启动了5次,然后就“稳定”并继续正确运行。

是否有可能记录到导致重新启动的 traceback 并将其保存到文件中?我假设某种 PANIC 错误导致了重新启动。我不认为这是内存问题,因为应用程序每30秒通过 http 向本地服务器报告堆栈大小。以下是日志片段:

Wed May 18 00:46:37 2016 -> '{"s":"1782","i":"1afe34d26348", "d":"heap=12408
Wed May 18 00:47:08 2016 -> '{"s":"1783","i":"1afe34d26348", "d":"heap=12408
Wed May 18 00:47:39 2016 -> '{"s":"1784","i":"1afe34d26348", "d":"heap=12408
Wed May 18 00:48:19 2016 -> '{"s":"1785","i":"1afe34d26348", "d":"heap=11432
Wed May 18 00:50:06 2016 -> '{"s":"0","i":"1afe34d26348", "d":"heap=14560
Wed May 18 00:51:25 2016 -> '{"s":"0","i":"1afe34d26348", "d":"heap=14584
Wed May 18 00:52:45 2016 -> '{"s":"0","i":"1afe34d26348", "d":"heap=14560
Wed May 18 00:54:04 2016 -> '{"s":"0","i":"1afe34d26348", "d":"heap=14584
Wed May 18 00:55:24 2016 -> '{"s":"0","i":"1afe34d26348", "d":"heap=14608
Wed May 18 00:55:55 2016 -> '{"s":"1","i":"1afe34d26348", "d":"heap=12608
Wed May 18 00:56:26 2016 -> '{"s":"2","i":"1afe34d26348", "d":"heap=12600
Wed May 18 00:56:56 2016 -> '{"s":"3","i":"1afe34d26348", "d":"heap=12624
Wed May 18 00:57:27 2016 -> '{"s":"4","i":"1afe34d26348", "d":"heap=12600

上述日志中,“s”是一个递增的序列计数器,当设备重新启动时,它被重置为0,“d”是堆栈大小(您可以忽略“i”条目,它只是发送数据的设备的 MAC 地址)。

在 PANIC 设备重置的情况下 xpcall 无法工作。

我尝试在重新启动后将 node.bootreason() 记录到文件中,但它不包含发生错误的 traceback。

是否有一种方法可以解决未连接到控制台的 nodemcu 应用程序的故障排除?

点赞