https - HTTPS 请求重启 NodeMCU
问题描述
节点MCU信息:
> NodeMCU custom build by frightanic.com
> branch: dev
> SSL: true
> modules: crypto,file,gpio,http,net,node,sjson,tmr,uart,wifi,tls
> powered by Lua 5.1.4 on SDK 2.2.1
> commit: d5aca39f485bf46e6d77b7fb05eaf71b8ea51bee
> Build type: integer -- tried float, same error
> LFS : disabled
构建 bin文件
当我在添加模块HTTPS
之前请求请求时,它在添加模块请求后tls
返回代码重新启动 NodeMCU。-1
tls
HTTPS
我用来发送请求的代码。
print(node.heap()) -- 31824
http.request("https://www.google.com", "HEAD", "", "",
function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end)
我尝试了网络模块。
print(node.heap()) -- 31824
srv = tls.createConnection()
srv:on("receive", function(sck, c) print(c) end)
srv:on("connection", function(sck, c)
sck:send("GET / HTTP/1.1\r\nHost: google.com\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
end)
srv:connect(443,"google.com")
我对这两个代码都有相同的重启原因。
HTTP client: hostname=google.com
HTTP client: port=443
HTTP client: method=GET
HTTP client: path=/
HTTP client: DNS request
HTTP client: DNS pending
> HTTP client: DNS found google.com 172.217.18.46
client handshake start.
Fatal exception 0(IllegalInstructionCause):
epc1=0x4027ca20, epc2=0x00000000, epc3=0x00000000, excvaddr=0x402993e7, depc=0x00000000
þ
ets Jan 8 2013,rst cause:2, boot mode:(3,x) -- sometimes x is 0, 6 or 7
load 0x40100000, len 26104, room 16
tail 8
chksum 0xc0
load 0x3ffe8000, len 2332, room 0
tail 12
chksum 0x3c
ho 0 tail 12 room 4
load 0x3ffe891c, len 136, room 12
tail 12
chksum 0x56
csum 0x56
在 net moudle 代码中,重新启动在srv:connect(443,"google.com")
被调用时发生并显示另外一行RecvHold, By pespconn,find conn_msg fail
解决方案
SDK Firmware 2.2.1
我通过使用具有相同模块和相同配置的Docker构建相同的内容来克服这个问题,无法控制在Cloud Build版本中调试的案例和行,因此无法知道 Cloud Build中到底出了什么问题。
Docker 固件信息
NodeMCU 2.2.0.0 built with Docker provided by frightanic.com
branch: master
commit: 4095c408e6a8cc9718cb06007b408d0aad15d9cd
SSL: true
Build type: integer
LFS: disabled
modules: crypto,file,gpio,http,net,node,sjson,tls,tmr,uart,wifi
build created on 2018-11-29 17:45
powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)
推荐阅读
- ios - 为什么 FileManager.default.attributesOfItem 在 NSFileCreationDate 中返回当前日期?
- reactjs - 无法读取 Redux + Firebase 中未定义的属性“名称”
- javascript - 当条件搜索为假时如何使用javascript更改表内的内容
- sql-server - MS SQL Server 管理复制数据库计划
- visual-studio - 如何在 Windows 中构建 glpk 时修复错误
- ios - SwiftUI:不要刷新自定义视图 MacOS 应用程序
- angular - 无法安装 @ionic-enterprise/couchbase-lite
- kdb - KDB+ 中具有多个值列的数据透视表
- angular - MatTableDatasource 的自定义排序数据源:首先选中复选框
- javascript - 当计时器分钟达到某个目标时,我如何更改页面的背景颜色?