Skip to content

安装时服务器内部错误:strconv.Atoi: out of range #343

@simonkuang

Description

@simonkuang

检查清单

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

1.6.0

使用的什么数据库?

SQLite3

使用的哪种方式部署?

Executable file

在线站点地址

No response

发生了什么?

安装过程中出现 500 Server Internal Error

2023-11-15T16:46:43.506Z DEBUG listener/template_config.go:136 load theme success {"theme": "Anatole"}
2023-11-15T16:46:43.532Z ERROR handler/server.go:229 handler error {"error": "option 类型错误 optionValue=1700066803520 kind=int: strconv.Atoi: parsing "1700066803520": value out of range", "errorVerbose": "strconv.Atoi: parsing "1700066803520": value out of range\noption 类型错误 optionValue=1700066803520 kind=int\ngithub.com/go-sonic/sonic/util/xerr.ErrorType.Wrapf\n\tgithub.com/go-sonic/sonic/util/xerr/error.go:46\ngithub.com/go-sonic/sonic/service/impl.(*optionServiceImpl).convert\n\tgithub.com/go-sonic/sonic/service/impl/option.go:196\ngithub.com/go-sonic/sonic/service/impl.(*optionServiceImpl).Save\n\tgithub.com/go-sonic/sonic/service/impl/option.go:224\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.createDefaultSetting\n\tgithub.com/go-sonic/sonic/service/impl/install.go:126\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.InstallBlog.func1\n\tgithub.com/go-sonic/sonic/service/impl/install.go:68\ngithub.com/go-sonic/sonic/dal.Transaction.func1\n\tgithub.com/go-sonic/sonic/dal/dal.go:129\ngithub.com/go-sonic/sonic/dal.Transaction.(*Query).Transaction.func2\n\tgithub.com/go-sonic/sonic/dal/gen.go:210\ngorm.io/gorm.(*DB).Transaction\n\tgorm.io/gorm@v1.25.5/finisher_api.go:647\ngithub.com/go-sonic/sonic/dal.(*Query).Transaction\n\tgithub.com/go-sonic/sonic/dal/gen.go:210\ngithub.com/go-sonic/sonic/dal.Transaction\n\tgithub.com/go-sonic/sonic/dal/dal.go:127\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.InstallBlog\n\tgithub.com/go-sonic/sonic/service/impl/install.go:64\ngithub.com/go-sonic/sonic/handler/admin.(*InstallHandler).InstallBlog\n\tgithub.com/go-sonic/sonic/handler/admin/install.go:35\ngithub.com/go-sonic/sonic/handler.(*Server).RegisterRouters.(*Server).wrapHandler.func8\n\tgithub.com/go-sonic/sonic/handler/server.go:227\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/go-sonic/sonic/handler/middleware.(*RecoveryMiddleware).RecoveryWithLogger.func1\n\tgithub.com/go-sonic/sonic/handler/middleware/recovery.go:62\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/go-sonic/sonic/handler/middleware.(*GinLoggerMiddleware).LoggerWithConfig.func1\n\tgithub.com/go-sonic/sonic/handler/middleware/log.go:50\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/gin-gonic/gin.(*Engine).handleHTTPRequest\n\tgithub.com/gin-gonic/gin@v1.9.1/gin.go:620\ngithub.com/gin-gonic/gin.(*Engine).ServeHTTP\n\tgithub.com/gin-gonic/gin@v1.9.1/gin.go:576\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:2938\nnet/http.(*conn).serve\n\tnet/http/server.go:2009\nruntime.goexit\n\truntime/asm_arm.s:859\n"}

硬件:Raspberrypi 4B+ & Raspberrypi 3B
系统:Raspbian OS(bullseye)arm & arm64
复现:以命令 ./sonic -config conf/config.yaml 直接运行;浏览器访问;安装界面提交信息时报错。错误信息从 log 文件中摘抄。

相关日志输出

"method": "POST", "path": "/api/admin/installations"}
2023-11-15T15:51:55.594Z        INFO    [GIN]   {"beginTime": "2023-11-15T15:51:55.593Z", "status": 200, "latency": 0.000143757, "clientIP": "192.168.6.106", "method": "GET", "path": "/api/admin/is_installed"}
2023-11-15T15:52:18.454Z        INFO    impl/option.go:204      [11.579ms] [rows:108] SELECT * FROM `option`
2023-11-15T15:52:18.456Z        INFO    impl/option.go:256      [1.071ms] [rows:1] UPDATE `option` SET `option_value`="c05769f58c054745aa2a7b92db1a97ff9de16dadcfec48e5978a313e59d3eff7780ba504d0cc4d37b2dc84b37a3cf1682dc4dc8312ab43eb9cc6f063422834336071baef8c1c47d2a1de5be558c2294dbc84fdc1b3424d8aaa202fc25fb594f699391fb66f234d73bdfeb6bbbcdf00af1f20c095aba8485dbfdc2e823517ce66" WHERE `option`.`id` = 108 AND `option`.`option_key` = "jwt_secret"
2023-11-15T15:52:18.466Z        INFO    impl/theme.go:260       [0.430ms] [rows:0] SELECT * FROM `theme_setting` WHERE `theme_setting`.`theme_id` = "caicai_anatole"
2023-11-15T15:52:18.466Z        DEBUG   listener/template_config.go:136 load theme success      {"theme": "Anatole"}
2023-11-15T15:52:18.477Z        INFO    impl/option.go:288      [10.258ms] [rows:108] SELECT * FROM `option`
2023-11-15T15:52:18.489Z        INFO    impl/option.go:204      [9.751ms] [rows:108] SELECT * FROM `option`
2023-11-15T15:52:18.490Z        ERROR   handler/server.go:229   handler error   {"error": "option 类型错误 optionValue=1700063538478 kind=int: strconv.Atoi: parsing \"1700063538478\": value out of range", "errorVerbose": "strconv.Atoi: parsing \"1700063538478\": value out of range\noption 类型错误 optionValue=1700063538478 kind=int\ngithub.com/go-sonic/sonic/util/xerr.ErrorType.Wrapf\n\tgithub.com/go-sonic/sonic/util/xerr/error.go:46\ngithub.com/go-sonic/sonic/service/impl.(*optionServiceImpl).convert\n\tgithub.com/go-sonic/sonic/service/impl/option.go:196\ngithub.com/go-sonic/sonic/service/impl.(*optionServiceImpl).Save\n\tgithub.com/go-sonic/sonic/service/impl/option.go:224\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.createDefaultSetting\n\tgithub.com/go-sonic/sonic/service/impl/install.go:126\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.InstallBlog.func1\n\tgithub.com/go-sonic/sonic/service/impl/install.go:68\ngithub.com/go-sonic/sonic/dal.Transaction.func1\n\tgithub.com/go-sonic/sonic/dal/dal.go:129\ngithub.com/go-sonic/sonic/dal.Transaction.(*Query).Transaction.func2\n\tgithub.com/go-sonic/sonic/dal/gen.go:210\ngorm.io/gorm.(*DB).Transaction\n\tgorm.io/gorm@v1.25.5/finisher_api.go:647\ngithub.com/go-sonic/sonic/dal.(*Query).Transaction\n\tgithub.com/go-sonic/sonic/dal/gen.go:210\ngithub.com/go-sonic/sonic/dal.Transaction\n\tgithub.com/go-sonic/sonic/dal/dal.go:127\ngithub.com/go-sonic/sonic/service/impl.installServiceImpl.InstallBlog\n\tgithub.com/go-sonic/sonic/service/impl/install.go:64\ngithub.com/go-sonic/sonic/handler/admin.(*InstallHandler).InstallBlog\n\tgithub.com/go-sonic/sonic/handler/admin/install.go:35\ngithub.com/go-sonic/sonic/handler.(*Server).RegisterRouters.(*Server).wrapHandler.func8\n\tgithub.com/go-sonic/sonic/handler/server.go:227\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/go-sonic/sonic/handler/middleware.(*RecoveryMiddleware).RecoveryWithLogger.func1\n\tgithub.com/go-sonic/sonic/handler/middleware/recovery.go:62\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/go-sonic/sonic/handler/middleware.(*GinLoggerMiddleware).LoggerWithConfig.func1\n\tgithub.com/go-sonic/sonic/handler/middleware/log.go:50\ngithub.com/gin-gonic/gin.(*Context).Next\n\tgithub.com/gin-gonic/gin@v1.9.1/context.go:174\ngithub.com/gin-gonic/gin.(*Engine).handleHTTPRequest\n\tgithub.com/gin-gonic/gin@v1.9.1/gin.go:620\ngithub.com/gin-gonic/gin.(*Engine).ServeHTTP\n\tgithub.com/gin-gonic/gin@v1.9.1/gin.go:576\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:2938\nnet/http.(*conn).serve\n\tnet/http/server.go:2009\nruntime.goexit\n\truntime/asm_arm.s:859\n"}
2023-11-15T15:52:18.491Z        INFO    [GIN]   {"beginTime": "2023-11-15T15:52:18.440Z", "status": 500, "latency": 0.050819438, "clientIP": "192.168.6.106", "method": "POST", "path": "/api/admin/installations"}
2023-11-15T15:52:18.519Z        INFO    [GIN]   {"beginTime": "2023-11-15T15:52:18.519Z", "status": 200, "latency": 0.000101276, "clientIP": "192.168.6.106", "method": "GET", "path": "/api/admin/is_installed"}

附加信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions