Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coroutine似乎被错误唤醒,导致整个流程都错乱了 #2005

Open
libla opened this issue Dec 9, 2024 · 3 comments
Open

coroutine似乎被错误唤醒,导致整个流程都错乱了 #2005

libla opened this issue Dec 9, 2024 · 3 comments

Comments

@libla
Copy link

libla commented Dec 9, 2024

已更新到v1.7.0

Describe the bug
测试发现skynet.timeout有可能不再执行,并且在日志中偶尔有[:00000008] lua call [0 to :8 : 658564 msgsz = 0] error : lib/skynet.lua:997: lib/skynet.lua:452: cannot resume dead coroutine或者[:00000008] lua call [a to :8 : 40534 msgsz = 2] error : lib/skynet.lua:997: lib/skynet.lua:452: lib/skynet.lua:402: attempt to call a boolean value (upvalue 'f')

To Reproduce
本地测试无法复现,只有长时间(超过1天)运行且有一定的活跃请求时才会出现

Additional context
1

2
3
4

@cloudwu
Copy link
Owner

cloudwu commented Dec 9, 2024

这些描述是现象而表达不了原因。依靠这些无法定位问题。

你需要在你的环境调试找到为什么 coroutine 是 dead coroutine ,以及为什么 401 行的 coroutine_yield "SUSPEND" 会返回 boolean 。

ps. 下次请用 markdown 语法编辑文本和代码,不要发图片。

@cloudwu
Copy link
Owner

cloudwu commented Dec 9, 2024

补充: 402 行的 f ,是从线程池 (coroutine_pool) 中取出之前结束的线程,然后在 https://github.com/cloudwu/skynet/blob/master/lualib/skynet.lua#L408 这里传入的新的主函数。

@libla
Copy link
Author

libla commented Dec 9, 2024

我猜测是coroutine在其他地方被覆盖替换了,本地不好重现,没法调试,还在看代码
之前用图片是为了把代码行数截出来。我对skynet.lua加了一个接口

local pid

function skynet.pid()
	if not pid then
		pid = c.intcommand("PID")
	end
	return pid
end

所以代码行数和标准版本文件对不上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants