I'm getting a race condition warning when running a daemon I'm coding. Linux 3.10, MySQL 5.7.16, Go 1.9, GORM 1.25.10:
WARNING: DATA RACE
Read at 0x00c001559010 by goroutine 120:
gorm.io/gorm/schema.(*Schema).guessRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:538 +0x1b19
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:88 +0x724
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm/schema.Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:117 +0x6e
gorm.io/gorm/schema.getOrParse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:422 +0x30a
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:74 +0x424
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/statement.go:492 +0x144
gorm.io/gorm.(*Statement).Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/statement.go:488 +0x3cd
gorm.io/gorm.(*processor).Execute()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/callbacks.go:105 +0x3a8
gorm.io/gorm.(*DB).Count()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/finisher_api.go:495 +0x11ac
kd-saas/common/repository.(*GormRepo[...]).Paginate()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/repository/paginate.go:9 +0x173
kd-saas/tenant/api/internal/handler/business.WalletRecordListHandler()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/tenant/api/internal/handler/business/wallet_record_list_handler.go:48 +0x424
kd-saas/tenant/api/internal/router.MakeHandler[...].func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/tenant/api/internal/router/define.go:26 +0x2a1
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/request/operation_log.(*Middleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/request/operation_log/operation_log_middleware.go:39 +0x5b5
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/request/operation_log.(*Trace).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/request/operation_log/trace_middleware.go:20 +0x61
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/database.(*TenantMiddleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/database/tenant_middleware.go:23 +0x6a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/assistant/auth.(*Middleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/assistant/auth/middleware.go:29 +0x4c4
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.Authorize.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/authhandler.go:81 +0x6cf
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.GunzipHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/gunziphandler.go:26 +0x13a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MaxBytesHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/maxbyteshandler.go:24 +0x16a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MetricHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/metrichandler.go:21 +0x110
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.RecoverHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/recoverhandler.go:21 +0xeb
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.(*timeoutHandler).ServeHTTP.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/timeouthandler.go:86 +0xe1
Previous write at 0x00c001559010 by goroutine 117:
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:121 +0x11ca
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm/schema.Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:117 +0x6e
gorm.io/gorm/schema.getOrParse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:422 +0x30a
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:74 +0x424
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm/schema.Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:117 +0x6e
gorm.io/gorm/schema.getOrParse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:422 +0x30a
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:74 +0x424
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm/schema.Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:117 +0x6e
gorm.io/gorm/schema.getOrParse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:422 +0x30a
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:74 +0x424
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm/schema.Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:117 +0x6e
gorm.io/gorm/schema.getOrParse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:422 +0x30a
gorm.io/gorm/schema.(*Schema).parseRelation()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/relationship.go:74 +0x424
gorm.io/gorm/schema.ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/schema/schema.go:341 +0x3aa4
gorm.io/gorm.(*Statement).ParseWithSpecialTableName()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/statement.go:492 +0x144
gorm.io/gorm.(*Statement).Parse()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/statement.go:488 +0x3cd
gorm.io/gorm.(*processor).Execute()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/callbacks.go:105 +0x3a8
gorm.io/gorm.(*DB).First()
/var/lib/jenkins/go/pkg/mod/gorm.io/gorm@v1.25.10/finisher_api.go:129 +0x2e4
kd-saas/common/repository.(*GormRepo[...]).First()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/repository/finisher.go:23 +0x14d
kd-saas/tenant/api/internal/handler/business.AddressHandler()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/tenant/api/internal/handler/business/address_handler.go:19 +0x18b
kd-saas/tenant/api/internal/router.MakeHandler[...].func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/tenant/api/internal/router/define.go:26 +0x1e4
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/request/operation_log.(*Middleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/request/operation_log/operation_log_middleware.go:21 +0x3a4
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/request/operation_log.(*Trace).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/request/operation_log/trace_middleware.go:20 +0x61
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/database.(*TenantMiddleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/database/tenant_middleware.go:23 +0x6a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
net/http.Handler.ServeHTTP-fm()
<autogenerated>:1 +0x75
kd-saas/common/assistant/auth.(*Middleware).Handle.func1()
/var/lib/jenkins/workspace/test_kd_saas_tenant_api/common/assistant/auth/middleware.go:29 +0x4c4
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.Authorize.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/authhandler.go:81 +0x6cf
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.GunzipHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/gunziphandler.go:26 +0x13a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MaxBytesHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/maxbyteshandler.go:24 +0x16a
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MetricHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/metrichandler.go:21 +0x110
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.RecoverHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/recoverhandler.go:21 +0xeb
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.(*timeoutHandler).ServeHTTP.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/timeouthandler.go:86 +0xe1
Goroutine 120 (running) created at:
github.com/zeromicro/go-zero/rest/handler.(*timeoutHandler).ServeHTTP()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/timeouthandler.go:80 +0x6d5
github.com/zeromicro/go-zero/rest/handler.SheddingHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/sheddinghandler.go:53 +0x22d
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.BreakerHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/breakerhandler.go:39 +0x206
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MaxConnsHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/maxconnshandler.go:30 +0x101
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.PrometheusHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/prometheushandler.go:45 +0x243
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.LogHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/loghandler.go:42 +0x657
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.TraceHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/tracehandler.go:64 +0x721
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/router.(*patRouter).ServeHTTP()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/router/patrouter.go:66 +0x1fd
net/http.serverHandler.ServeHTTP()
/usr/local/go/src/net/http/server.go:2947 +0x641
net/http.(*conn).serve()
/usr/local/go/src/net/http/server.go:1991 +0xbe4
net/http.(*Server).Serve.func3()
/usr/local/go/src/net/http/server.go:3102 +0x58
Goroutine 117 (running) created at:
github.com/zeromicro/go-zero/rest/handler.(*timeoutHandler).ServeHTTP()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/timeouthandler.go:80 +0x6d5
github.com/zeromicro/go-zero/rest/handler.SheddingHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/sheddinghandler.go:53 +0x22d
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.BreakerHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/breakerhandler.go:39 +0x206
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.MaxConnsHandler.func2.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/maxconnshandler.go:30 +0x101
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.PrometheusHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/prometheushandler.go:45 +0x243
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.LogHandler.func1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/loghandler.go:42 +0x657
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/handler.TraceHandler.func1.1()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/handler/tracehandler.go:64 +0x721
net/http.HandlerFunc.ServeHTTP()
/usr/local/go/src/net/http/server.go:2109 +0x4d
github.com/zeromicro/go-zero/rest/router.(*patRouter).ServeHTTP()
/var/lib/jenkins/go/pkg/mod/github.com/zeromicro/go-zero@v1.6.4/rest/router/patrouter.go:66 +0x1fd
net/http.serverHandler.ServeHTTP()
/usr/local/go/src/net/http/server.go:2947 +0x641
net/http.(*conn).serve()
/usr/local/go/src/net/http/server.go:1991 +0xbe4
net/http.(*Server).Serve.func3()
/usr/local/go/src/net/http/server.go:3102 +0x58
I'm getting a race condition warning when running a daemon I'm coding. Linux 3.10, MySQL 5.7.16, Go 1.9, GORM 1.25.10: