gotoeasy / glogcenter

一个golang实现的日志中心glogcenter,简称GLC,资源占用低,性能高。作为传统ELK的替代方案,上至央企大项目下至本地开发调试,已历经众多案例磨炼,表现稳定出色,达生产级别应用要求。
https://glc.gotoeasy.top
GNU Lesser General Public License v3.0
101 stars 29 forks source link

集群模式,其中一个节点,报错fatal error: concurrent map read and map write #58

Open tianhuo3652 opened 2 days ago

tianhuo3652 commented 2 days ago

请问大佬,集群化模式,其中一个节点,提示以下错误,导致该节点服务宕机 fatal error: concurrent map read and map write goroutine 73043105 [running]: glc/ldb/storage.NewLogDataStorageHandle({0xc004b10b40, 0x10}) D:/Go/path/glogcenter/glc/ldb/storage/storage_handle.go:29 +0x38 glc/ldb.NewDefaultEngine() D:/Go/path/glogcenter/glc/ldb/engine.go:37 +0x2a glc/www/controller.addDataModelLog(0xc00421c680) D:/Go/path/glogcenter/glc/www/controller/log_add_controller.go:60 +0x1c glc/www/controller.JsonLogTransferAddController(0xc004210cc0) D:/Go/path/glogcenter/glc/www/controller/log_add_controller.go:53 +0x1a7 glc/gweb.Run.func2(0xc0024d2e00) D:/Go/path/glogcenter/glc/gweb/http_server.go:122 +0x3b8 github.com/gin-gonic/gin.(Context).Next(...) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc0024d2e00) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 +0x7a github.com/gin-gonic/gin.(Context).Next(...) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.LoggerWithConfig.func1(0xc0024d2e00) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 +0xdd github.com/gin-gonic/gin.(Context).Next(...) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.serveError(0xc0024d2e00, 0x194, {0x205c3f0, 0x12, 0x12}) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:656 +0x4b github.com/gin-gonic/gin.(Engine).handleHTTPRequest(0xc00015aea0, 0xc0024d2e00) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:649 +0x4a5 github.com/gin-gonic/gin.(Engine).ServeHTTP(0xc00015aea0, {0x177a438, 0xc0009a5dc0}, 0xc001d73b00) D:/Go/path/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 +0x1b2 net/http.serverHandler.ServeHTTP({0x1775f48?}, {0x177a438?, 0xc0009a5dc0?}, 0x6?) D:/Go/go1.22.1/src/net/http/server.go:3137 +0x8e net/http.(conn).serve(0xc000c96120, {0x177d0a0, 0xc0019132c0}) D:/Go/go1.22.1/src/net/http/server.go:2039 +0x5e8 created by net/http.(*Server).Serve in goroutine 1 D:/Go/go1.22.1/src/net/http/server.go:3285 +0x4b4

goroutine 1 [IO wait]: internal/poll.runtime_pollWait(0x7f08be3a0110, 0x72) D:/Go/go1.22.1/src/runtime/netpoll.go:345 +0x85 internal/poll.(pollDesc).wait(0x33?, 0x21cc?, 0x0) D:/Go/go1.22.1/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(pollDesc).waitRead(...) D:/Go/go1.22.1/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(FD).Accept(0xc000056f80) D:/Go/go1.22.1/src/internal/poll/fd_unix.go:611 +0x2ac net.(netFD).accept(0xc000056f80) D:/Go/go1.22.1/src/net/fd_unix.go:172 +0x29 net.(TCPListener).accept(0xc000156de0) D:/Go/go1.22.1/src/net/tcpsock_posix.go:159 +0x1e net.(TCPListener).Accept(0xc000156de0) D:/Go/go1.22.1/src/net/tcpsock.go:327 +0x30 net/http.(Server).Serve(0xc0002f20f0, {0x177a7f8, 0xc000156de0}) D:/Go/go1.22.1/src/net/http/server.go:3255 +0x33e net/http.(Server).ListenAndServe(0xc0002f20f0) D:/Go/go1.22.1/src/net/http/server.go:3184 +0x71 glc/gweb.Run() D:/Go/path/glogcenter/glc/gweb/http_server.go:144 +0x531 glc/gweb/http.StartHttpServer(0x10?) D:/Go/path/glogcenter/glc/gweb/http/start_httpserver.go:12 +0x17 glc/onstart.Run(...) D:/Go/path/glogcenter/glc/onstart/onstart.go:17 main.main() D:/Go/path/glogcenter/glc/main.go:15 +0x73 这种问题,是因为什么原因导致的?

gotoeasy commented 2 days ago

报错信息第一行写的就是原因

你这是什么版本?改动了什么吗?启动就报错还是什么情况下就报错。。。。?

tianhuo3652 commented 2 days ago

15.1 版本是 15.1 2024/11/15 23:59:59 INFO 空闲等待接收日志 2024/11/15 23:59:59 INFO 空闲等待接收日志 2024/11/15 23:59:59 INFO 空闲等待接收日志 2024/11/16 00:00:00 INFO 空闲等待接收日志 2024/11/16 00:00:00 INFO 打开WordIndexStorage: logdata-20241116/inverted/k 2024/11/16 00:00:00 INFO 打开LogDataStorage: logdata-20241116/data fatal error: concurrent map read and map write 启动不报错,运行了几天之后,其中一个节点,报了这个错误

gotoeasy commented 2 days ago

这个复现困难,易改难测,等下个版本改改看吧

gotoeasy commented 23 hours ago

v0.17.3 已修改

tianhuo3652 commented 21 hours ago

谢谢大佬