Skip to content

Server data race in session model #320

@luskaner

Description

@luskaner
==================
WARNING: DATA RACE
Read at 0x00c000488020 by goroutine 91:
  github.com/luskaner/ageLANServer/server/internal/models.(*SessionData).Id()
      S:/Programacion/ageLANServer/server/internal/models/session.go:40 +0x33
  github.com/luskaner/ageLANServer/server/internal/routes/game/login.Platformlogin()
      S:/Programacion/ageLANServer/server/internal/routes/game/login/platformlogin.go:50 +0x10cf
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.(*ServeMux).ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2822 +0x5c5
  github.com/luskaner/ageLANServer/server/internal/routes/router.SessionMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/sessionMiddleware.go:38 +0x67c
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  github.com/gorilla/handlers.loggingHandler.ServeHTTP()
      C:/Users/luska/go/pkg/mod/github.com/gorilla/handlers@v1.5.2/logging.go:47 +0x210
  github.com/gorilla/handlers.(*loggingHandler).ServeHTTP()
      <autogenerated>:1 +0xf5
  github.com/luskaner/ageLANServer/server/internal/routes/router.HostMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/hostMiddleware.go:40 +0x2c4
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.(*ServeMux).ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2822 +0x5c5
  github.com/luskaner/ageLANServer/server/internal/routes/router.TitleMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/titleMiddleware.go:13 +0x289
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  github.com/luskaner/ageLANServer/server/internal/routes/router.NewLoggingMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/loggerMiddleware.go:62 +0x3b1
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.serverHandler.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:3301 +0x3ab
  net/http.(*conn).serve()
      S:/go/go1.24.10/src/net/http/server.go:2102 +0x2cda
  net/http.(*Server).Serve.gowrap3()
      S:/go/go1.24.10/src/net/http/server.go:3454 +0x64

Previous write at 0x00c000488020 by goroutine 88:
  github.com/luskaner/ageLANServer/server/internal/models.(*MainSessions).Create()
      S:/Programacion/ageLANServer/server/internal/models/session.go:107 +0x2a5
  github.com/luskaner/ageLANServer/server/internal/routes/game/login.Platformlogin()
      S:/Programacion/ageLANServer/server/internal/routes/game/login/platformlogin.go:52 +0x1189
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.(*ServeMux).ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2822 +0x5c5
  github.com/luskaner/ageLANServer/server/internal/routes/router.SessionMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/sessionMiddleware.go:38 +0x67c
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  github.com/gorilla/handlers.loggingHandler.ServeHTTP()
      C:/Users/luska/go/pkg/mod/github.com/gorilla/handlers@v1.5.2/logging.go:47 +0x210
  github.com/gorilla/handlers.(*loggingHandler).ServeHTTP()
      <autogenerated>:1 +0xf5
  github.com/luskaner/ageLANServer/server/internal/routes/router.HostMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/hostMiddleware.go:40 +0x2c4
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.(*ServeMux).ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2822 +0x5c5
  github.com/luskaner/ageLANServer/server/internal/routes/router.TitleMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/titleMiddleware.go:13 +0x289
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  github.com/luskaner/ageLANServer/server/internal/routes/router.NewLoggingMiddleware.func1()
      S:/Programacion/ageLANServer/server/internal/routes/router/loggerMiddleware.go:62 +0x3b1
  net/http.HandlerFunc.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:2294 +0x63
  net/http.serverHandler.ServeHTTP()
      S:/go/go1.24.10/src/net/http/server.go:3301 +0x3ab
  net/http.(*conn).serve()
      S:/go/go1.24.10/src/net/http/server.go:2102 +0x2cda
  net/http.(*Server).Serve.gowrap3()
      S:/go/go1.24.10/src/net/http/server.go:3454 +0x64

Goroutine 91 (running) created at:
  net/http.(*Server).Serve()
      S:/go/go1.24.10/src/net/http/server.go:3454 +0x1104
  net/http.(*Server).ServeTLS()
      S:/go/go1.24.10/src/net/http/server.go:3493 +0x746
  net/http.(*Server).ListenAndServeTLS()
      S:/go/go1.24.10/src/net/http/server.go:3709 +0x42b
  github.com/luskaner/ageLANServer/server/internal/cmd.init.func1.2()
      S:/Programacion/ageLANServer/server/internal/cmd/root.go:249 +0x135

Goroutine 88 (running) created at:
  net/http.(*Server).Serve()
      S:/go/go1.24.10/src/net/http/server.go:3454 +0x1104
  net/http.(*Server).ServeTLS()
      S:/go/go1.24.10/src/net/http/server.go:3493 +0x746
  net/http.(*Server).ListenAndServeTLS()
      S:/go/go1.24.10/src/net/http/server.go:3709 +0x42b
  github.com/luskaner/ageLANServer/server/internal/cmd.init.func1.2()
      S:/Programacion/ageLANServer/server/internal/cmd/root.go:249 +0x135
==================

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserverserver executable or genCert

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions