go-sonic / sonic

Sonic is a blogging platform developed by Go. Simple and powerful
MIT License
1.99k stars 255 forks source link

第一次启动后再次运行出错 #346

Closed KawausoJyou closed 4 months ago

KawausoJyou commented 10 months ago

检查清单

是什么版本出现了此问题?

v1.1.3

使用的什么数据库?

SQLite3

使用的哪种方式部署?

Executable file

在线站点地址

https://blog.kawauso.xyz

发生了什么?

使用SSH连接VPS并成功运行后,关闭SSH再次连接VPS无法运行。 出错日志如下。

相关日志输出

panic: handlers are already registered for path '/'

goroutine 1 [running]:
github.com/gin-gonic/gin.(*node).addRoute(0x1578553?, {0x17e845c, 0x1}, {0xc0006e8fe0?, 0x4, 0x4})
    github.com/gin-gonic/gin@v1.9.1/tree.go:260 +0x71b
github.com/gin-gonic/gin.(*Engine).addRoute(0xc00066ad00, {0x1578553, 0x3}, {0x17e845c, 0x1}, {0xc0006e8fe0, 0x4, 0x4})
    github.com/gin-gonic/gin@v1.9.1/gin.go:335 +0x26d
github.com/gin-gonic/gin.(*RouterGroup).handle(0xc000589500, {0x1578553, 0x3}, {0x0?, 0x14c3ee0?}, {0xc0006e7070, 0x1, 0x420ec8?})
    github.com/gin-gonic/gin@v1.9.1/routergroup.go:89 +0x145
github.com/gin-gonic/gin.(*RouterGroup).GET(...)
    github.com/gin-gonic/gin@v1.9.1/routergroup.go:117
github.com/go-sonic/sonic/handler.(*Server).registerDynamicRouters(0xc000684e00, 0x1578553?)
    github.com/go-sonic/sonic/handler/router.go:391 +0x405
github.com/go-sonic/sonic/handler.(*Server).RegisterRouters(0xc000684e00)
    github.com/go-sonic/sonic/handler/router.go:305 +0xd11b
main.InitApp.func1(0x0?)
    github.com/go-sonic/sonic/main.go:70 +0x13
reflect.Value.call({0x1380160?, 0x1609878?, 0x180b008?}, {0x15795d6, 0x4}, {0xc0006e4258, 0x1, 0x0?})
    reflect/value.go:596 +0xce7
reflect.Value.Call({0x1380160?, 0x1609878?, 0x418ec5?}, {0xc0006e4258?, 0x1426400?, 0xc0006e4201?})
    reflect/value.go:380 +0xb9
go.uber.org/dig.defaultInvoker({0x1380160?, 0x1609878?, 0xc0006e3bd0?}, {0xc0006e4258?, 0x1?, 0x1803480?})
    go.uber.org/dig@v1.17.1/container.go:238 +0x25
go.uber.org/dig.(*Scope).Invoke(0xc00037ec80, {0x1380160, 0x1609878}, {0x0, 0x0, 0x1609878?})
    go.uber.org/dig@v1.17.1/invoke.go:160 +0x70b
go.uber.org/dig.(*Container).Invoke(0x20?, {0x1380160?, 0x1609878?}, {0x0?, 0x7f6983bc7108?, 0x20?})
    go.uber.org/dig@v1.17.1/invoke.go:82 +0x25
go.uber.org/fx.runInvoke({0x7f6936f1f5d8?, 0xc000050a28?}, {{0x1380160, 0x1609878}, {0xc00037ea00, 0x3, 0x4}})
    go.uber.org/fx@v1.20.1/invoke.go:108 +0x1f0
go.uber.org/fx.(*module).executeInvoke(0xc0000aaea0, {{0x1380160, 0x1609878}, {0xc00037ea00, 0x3, 0x4}})
    go.uber.org/fx@v1.20.1/module.go:288 +0x137
go.uber.org/fx.(*module).executeInvokes(0xc0000aaea0)
    go.uber.org/fx@v1.20.1/module.go:274 +0xe7
go.uber.org/fx.New({0xc000146000, 0x14, 0x1?})
    go.uber.org/fx@v1.20.1/app.go:503 +0xa1d
main.InitApp()
    github.com/go-sonic/sonic/main.go:74 +0x5de
main.main()
    github.com/go-sonic/sonic/main.go:24 +0x17
root@Debian:/home/Sonic# /home/Sonic/sonic -config /home/Sonic/conf/config.yaml
panic: handlers are already registered for path '/'

goroutine 1 [running]:
github.com/gin-gonic/gin.(*node).addRoute(0x1578553?, {0x17e845c, 0x1}, {0xc0006fefc0?, 0x4, 0x4})
    github.com/gin-gonic/gin@v1.9.1/tree.go:260 +0x71b
github.com/gin-gonic/gin.(*Engine).addRoute(0xc000696820, {0x1578553, 0x3}, {0x17e845c, 0x1}, {0xc0006fefc0, 0x4, 0x4})
    github.com/gin-gonic/gin@v1.9.1/gin.go:335 +0x26d
github.com/gin-gonic/gin.(*RouterGroup).handle(0xc0005915c0, {0x1578553, 0x3}, {0x0?, 0x14c3ee0?}, {0xc000720ea0, 0x1, 0x420ec8?})
    github.com/gin-gonic/gin@v1.9.1/routergroup.go:89 +0x145
github.com/gin-gonic/gin.(*RouterGroup).GET(...)
    github.com/gin-gonic/gin@v1.9.1/routergroup.go:117
github.com/go-sonic/sonic/handler.(*Server).registerDynamicRouters(0xc000694e00, 0x1578553?)
    github.com/go-sonic/sonic/handler/router.go:391 +0x405
github.com/go-sonic/sonic/handler.(*Server).RegisterRouters(0xc000694e00)
    github.com/go-sonic/sonic/handler/router.go:305 +0xd11b
main.InitApp.func1(0x0?)
    github.com/go-sonic/sonic/main.go:70 +0x13
reflect.Value.call({0x1380160?, 0x1609878?, 0x180b008?}, {0x15795d6, 0x4}, {0xc0006fa258, 0x1, 0x0?})
    reflect/value.go:596 +0xce7
reflect.Value.Call({0x1380160?, 0x1609878?, 0x418ec5?}, {0xc0006fa258?, 0x1426400?, 0xc0006fa201?})
    reflect/value.go:380 +0xb9
go.uber.org/dig.defaultInvoker({0x1380160?, 0x1609878?, 0xc0006fd860?}, {0xc0006fa258?, 0x1?, 0x1803480?})
    go.uber.org/dig@v1.17.1/container.go:238 +0x25
go.uber.org/dig.(*Scope).Invoke(0xc00037ca00, {0x1380160, 0x1609878}, {0x0, 0x0, 0x1609878?})
    go.uber.org/dig@v1.17.1/invoke.go:160 +0x70b
go.uber.org/dig.(*Container).Invoke(0x20?, {0x1380160?, 0x1609878?}, {0x0?, 0x7f39f1ac2108?, 0x20?})
    go.uber.org/dig@v1.17.1/invoke.go:82 +0x25
go.uber.org/fx.runInvoke({0x7f39a8e38d98?, 0xc000050a20?}, {{0x1380160, 0x1609878}, {0xc00037c780, 0x3, 0x4}})
    go.uber.org/fx@v1.20.1/invoke.go:108 +0x1f0
go.uber.org/fx.(*module).executeInvoke(0xc0000aab60, {{0x1380160, 0x1609878}, {0xc00037c780, 0x3, 0x4}})
    go.uber.org/fx@v1.20.1/module.go:288 +0x137
go.uber.org/fx.(*module).executeInvokes(0xc0000aab60)
    go.uber.org/fx@v1.20.1/module.go:274 +0xe7
go.uber.org/fx.New({0xc000164000, 0x14, 0x1?})
    go.uber.org/fx@v1.20.1/app.go:503 +0xa1d
main.InitApp()
    github.com/go-sonic/sonic/main.go:74 +0x5de
main.main()
    github.com/go-sonic/sonic/main.go:24 +0x17

附加信息

No response

jakezhu9 commented 10 months ago

看起来是 archivePath 为空导致的,但是理论上这个应该就是默认值,不会被更改

https://github.com/go-sonic/sonic/blob/b5e11018337b8a003a36b31bfa340457a59a9b77/handler/router.go#L391

暂时没法复现,还在寻找原因中... 重新安装一下试试?

tiny-flame commented 9 months ago

看起来是 archivePath 为空导致的,但是理论上这个应该就是默认值,不会被更改

https://github.com/go-sonic/sonic/blob/b5e11018337b8a003a36b31bfa340457a59a9b77/handler/router.go#L391

暂时没法复现,还在寻找原因中... 重新安装一下试试?

百分百复现

jakezhu9 commented 9 months ago

百分百复现

可以提供更多的信息吗,你的运行环境,sonic的版本,复现过程等,感谢

UnclePeel commented 8 months ago

Earth主题,重启一次服务器,前端就提示服务器内部错误,只有后台能进了,换回Anatole主题正常了,试了几次,重装了几次,依然如此。

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days