-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
联系方式
No response
1Panel 版本
1.7.4
问题描述
2022/12/22 19:56:14 1420 :233 (断电开机 时间错乱?)
[2022-12-22 19:56:14] [ERROR] App Store synchronization failed
[2023-10-31 14:14:58] [INFO] AppStore scheduled task in progress ...
[2023-10-31 14:14:58] [INFO] Starting synchronization with App Store...
[2023-10-31 14:14:58] [INFO] The scheduled certificate update task is currently in progress ...
[2023-10-31 14:14:58] [INFO] The scheduled certificate update task has completed
[2023-10-31 14:14:58] [INFO] Website scheduled task in progress ...
[2023-10-31 14:14:58] [INFO] Website scheduled task has completed
[2023-10-31 14:15:02] [INFO] start to handle remove expired, retain copies: 7
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x52d6c0]
goroutine 114 [running]:
github.com/gin-gonic/gin.(*Context).requestHeader(...)
github.com/gin-gonic/[email protected]/context.go:833
github.com/gin-gonic/gin.(*Context).GetHeader(...)
github.com/gin-gonic/[email protected]/context.go:871
github.com/1Panel-dev/1Panel/backend/i18n.GinI18nLocalize.func1(0x7f02f902f9?, {0x205e8dd, 0x2})
github.com/1Panel-dev/1Panel/backend/i18n/i18n.go:71 +0x20
github.com/gin-contrib/i18n.(*ginI18nImpl).getMessage(0x4001962840, {0x1a0e480, 0x40008ee140})
github.com/gin-contrib/[email protected]/ginI18n.go:26 +0x64
github.com/gin-contrib/i18n.(*ginI18nImpl).mustGetMessage(0x0?, {0x1a0e480?, 0x40008ee140?})
github.com/gin-contrib/[email protected]/ginI18n.go:44 +0x24
github.com/gin-contrib/i18n.MustGetMessage(...)
github.com/gin-contrib/[email protected]/i18n.go:67
github.com/1Panel-dev/1Panel/backend/i18n.GetErrMsg({0x1f3fca0, 0x10}, 0x400196e840)
github.com/1Panel-dev/1Panel/backend/i18n/i18n.go:41 +0xb8
github.com/1Panel-dev/1Panel/backend/buserr.BusinessError.Error({{0x1f3fca0, 0x10}, {0x0, 0x0}, 0x400196e840, {0x3e449c0, 0x400196e810}})
github.com/1Panel-dev/1Panel/backend/buserr/errors.go:20 +0x50
github.com/1Panel-dev/1Panel/backend/cron/job.(*app).Run(0x400006b770?)
github.com/1Panel-dev/1Panel/backend/cron/job/app.go:17 +0x68
github.com/robfig/cron/v3.DelayIfStillRunning.func1.1()
github.com/robfig/cron/[email protected]/chain.go:71 +0x1a8
github.com/robfig/cron/v3.FuncJob.Run(0x0?)
github.com/robfig/cron/[email protected]/cron.go:136 +0x24
github.com/robfig/cron/v3.(*Cron).startJob.func1()
github.com/robfig/cron/[email protected]/cron.go:312 +0x60
created by github.com/robfig/cron/v3.(*Cron).startJob
github.com/robfig/cron/[email protected]/cron.go:310 +0xa8
[2023-10-31 14:15:09] [INFO] init logger successfully
[2023-10-31 14:15:09] [INFO] init db successfully
[2023-10-31 14:15:09] [INFO] Migration run successfully
[2023-10-31 14:15:09] [INFO] init cache successfully
[2023-10-31 14:15:09] [INFO] init session successfully
[2023-10-31 14:15:12] [INFO] add ntp job time successful
[2023-10-31 14:15:12] [INFO] start cronjob entryID: 5
[2023-10-31 14:15:12] [INFO] add shell job 重启docker_中午11点 successful
[2023-10-31 14:15:12] [INFO] start cronjob entryID: 6
[2023-10-31 14:15:12] [INFO] add shell job 重启frpc successful
[2023-10-31 14:15:12] [INFO] start cronjob entryID: 7
[2023-10-31 14:15:12] [INFO] add shell job 重启docker_晚上8点 successful
[2023-10-31 14:15:12] [INFO] start cronjob entryID: 8
[2023-10-31 14:15:12] [INFO] Starting synchronization with App Store...
[2023-10-31 14:15:12] [INFO] server run success on 233 with http
每一个重启docke任务都是分开定时的,不能同时运行,会相互卡bug(同样的docker命令同时并行),结果1panel通电开机就全部 每个都执行,导致docker完整卡住一个容器都跑不了。。。
如果通电开机就一个个启动计划任务,那设置指定时间还有何意义,
start cronjob 都没做二次时间验证,都不判断当前系统时间到没到job指定的时间?
重现步骤
断电重启。
同一个
docker-compose -f /XXX.yml down --volumes && docker network prune -f && docker-compose -f /XXX.yml up -d --pull=always && sleep 5 && docker system prune --volumes -f
一个设置中午11点执行,
一个设置晚上8点执行,
通电开机并行,直接任务都 卡住 '一直运行中',容器一直不上线。
期待的正确结果
通电开机,计划任务不应该 就立即 不区分 该任务设置的时间 就运行。
start cronjob 应该引入协程来hook验证 当前任务配置的时间到没到。
如果start的逻辑有bug,那么这个协程就是一个安全锁。
而且说实话,任何计划任务,都应该在开机 1panel 默认强制获取一次 ntp时间之后,再开启整个进程。
当然需要考虑线下服务器断网单独开机无法获取ntp时间同步的情况。尽最大可能先确保服务器时间OK,才能进一步确认计划任务时间对得上。退而求其次,脱机服务器就只能跳过ntp直接开始计划任务总控进程。
ps,有没有一种可能,1panel缓存导致?
对于线下脱机服务器,想用1panel,能不能提供无缓存模式启动1panel?开机跳过缓存我觉得更合理。这几秒消耗初始化还是值得的。
相关日志输出
No response
附加信息
No response