加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Luasocket nginx错误 – lua条目线程中止:运行时错误:尝试跨

发布时间:2020-12-13 21:34:36 所属栏目:Nginx 来源:网络整理
导读:当我使用以下脚本时: local smtp = require("socket.smtp")local from = "from@host"local rcpt = "rcpt@host"local msg = { headers = { to = rcpt,subject = "Hi" },body = "Hello"}smtp.send{from = from,rcpt = rcpt,source = smtp.message(msg)} 我收

当我使用以下脚本时:

local smtp = require("socket.smtp")
local from = "from@host"
local rcpt = "rcpt@host"
local msg = {
  headers = {
    to = rcpt,subject = "Hi"
  },body = "Hello"
}
smtp.send{from = from,rcpt = rcpt,source = smtp.message(msg)}

我收到一条错误消息:lua entry thread aborted:runtime error:尝试跨越C-call边界.

我正在使用从Luaocks安装的最新luasocket和使用LuaJIT 2.1编译的nginx的Lua 5.1.是什么导致此错误消息,我该如何解决?

最佳答案
smtp.send使用LuaSocket的socket.protect函数来处理内部错误.此函数在C中实现,并且不允许在当前版本中产生(git HEAD中的版本现在允许在Lua 5.2上产生,请参阅讨论here).显然有人试图从内部屈服.在LuaSocket包中的etc / dispatch.lua中(更好地使用git HEAD版本),有一个replacement function for socket.protect应该允许在所有Lua版本上产生(以额外的临时协程为代价).您可以尝试使用该Lua函数替换C函数,如下所示:

local socket = require("socket")
local base = _G
-- paste modified socket.protect function here

-- continue with your own code:
local smtp = require("socket.smtp")
-- ...

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读