-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
[Bug]: 在前一个log上传未完全的情况下开启新log会导致log死锁,无法通过除了log halt之外的方式关闭,且无log名 #1034
Labels
bug
Something isn't working
Comments
啊?? |
在修gorm的时候疑似发现问题原因: 在log end时: if cmdArgs.IsArgEqual(1, "end") {
if group.LogCurName == "" {
ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:记录_关闭_失败"))
return CmdExecuteResult{Matched: true, Solved: true}
}
lines, _ := model.LogLinesCountGet(ctx.Dice.DBLogs, group.GroupID, group.LogCurName)
VarSetValueInt64(ctx, "$t当前记录条数", lines)
VarSetValueStr(ctx, "$t记录名称", group.LogCurName)
text := DiceFormatTmpl(ctx, "日志:记录_结束")
// Note: 2024-02-28 经过讨论,日志在 off 的情况下 end 属于合理操作,这里不再检查是否开启
// if !group.LogOn {
// text = strings.TrimRightFunc(DiceFormatTmpl(ctx, "日志:记录_关闭_失败"), unicode.IsSpace) + "\n" + text
// }
ReplyToSender(ctx, msg, text)
group.LogOn = false
group.UpdatedAtTime = time.Now().Unix()
time.Sleep(time.Duration(0.3 * float64(time.Second)))
getAndUpload(group.GroupID, group.LogCurName)
group.LogCurName = ""
group.UpdatedAtTime = time.Now().Unix()
return CmdExecuteResult{Matched: true, Solved: true}
} 如果getAndUpload消耗太长时间(这是正常的,部分骰主机器是小水管 + 压缩 + 大LOG),那么group.LogCurName就暂时不会被执行设置为空。 而又由于此时可以执行log new,因为LogOn = false,所以可以成功执行 之后设置为空,就会变成疑似上面的问题情况。 一种治标不治本的缓解办法为,对所有的getAndUpload改代码为: else if cmdArgs.IsArgEqual(1, "end") {
if group.LogCurName == "" {
ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:记录_关闭_失败"))
return CmdExecuteResult{Matched: true, Solved: true}
}
lines, _ := model.LogLinesCountGet(ctx.Dice.DBLogs, group.GroupID, group.LogCurName)
VarSetValueInt64(ctx, "$t当前记录条数", lines)
VarSetValueStr(ctx, "$t记录名称", group.LogCurName)
text := DiceFormatTmpl(ctx, "日志:记录_结束")
// Note: 2024-02-28 经过讨论,日志在 off 的情况下 end 属于合理操作,这里不再检查是否开启
// if !group.LogOn {
// text = strings.TrimRightFunc(DiceFormatTmpl(ctx, "日志:记录_关闭_失败"), unicode.IsSpace) + "\n" + text
// }
ReplyToSender(ctx, msg, text)
group.LogOn = false
group.UpdatedAtTime = time.Now().Unix()
time.Sleep(time.Duration(0.3 * float64(time.Second)))
// 丢到另一个线程里去,缓解阻塞
go getAndUpload(group.GroupID, group.LogCurName)
group.LogCurName = ""
group.UpdatedAtTime = time.Now().Unix()
return CmdExecuteResult{Matched: true, Solved: true}
} 由于getAndUpload只是上传后回复,所以可以干脆让它跑在另一个线程,此时只有比较极端的情况才会导致该comment的问题。 没有想到更好方案,上述方案已经测试,简单测试发送仍然是通过的: |
PaienNate
added a commit
to PaienNate/sealdice-core
that referenced
this issue
Oct 14, 2024
Merged
Xiangze-Li
pushed a commit
that referenced
this issue
Oct 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在提问之前...
问题描述
在前一个log上传未完全的情况下开启新log会导致log死锁,无法通过除了log halt之外的方式关闭,log off显示无正在记录的log,log on显示有正在记录的log,log指令显示log开启且无log名,在log list 、webui和log export里能找到对应log,但均无log名
如何复现
在前一个log上传未完全的情况下开启新log,未完全包括大log或者染色器出现问题等情况?
你期望发生的
按照设计,log off正常关闭,log on正常开启,不会出现空白日志名的问题
实际上发生的
log off显示无正在记录的log,log on显示有正在记录的log,log指令显示log开启且无log名,在log list 、webui和log export里能找到对应log,但均无log名
日志文件
触发:
上一次触发:
无具体报错日志
截图
No response
海豹核心版本
1.4.5/1.4.6
操作系统
windows 2012/windows 2022
帐号类型
QQ(在此账号出现问题)、offical QQ、kook、dodo
使用协议
No response
附加内容
No response
The text was updated successfully, but these errors were encountered: