Skip to content

Data race issues are often found in pgstore.(*PGStore).MaxAge() #40

@abekoh

Description

@abekoh

Data race issues are often found in pgstore.(*PGStore).MaxAge(), in our application when run with the -race flag.

==================
WARNING: DATA RACE
Write at 0x00c000bb0950 by goroutine 64:
  github.com/gorilla/securecookie.(*SecureCookie).MaxAge()
      /Users/kotaro_abe/pkg/mod/github.com/gorilla/[email protected]/securecookie.go:203 +0x51c
  github.com/antonlindstrom/pgstore.(*PGStore).MaxAge()
      /Users/kotaro_abe/pkg/mod/github.com/antonlindstrom/[email protected]/pgstore.go:164 +0x52c
  github.com/antonlindstrom/pgstore.(*PGStore).New()
      /Users/kotaro_abe/pkg/mod/github.com/antonlindstrom/[email protected]/pgstore.go:105 +0x428
  github.com/gorilla/sessions.(*Registry).Get()
      /Users/kotaro_abe/pkg/mod/github.com/gorilla/[email protected]/sessions.go:139 +0xf8
  github.com/antonlindstrom/pgstore.(*PGStore).Get()
      /Users/kotaro_abe/pkg/mod/github.com/antonlindstrom/[email protected]/pgstore.go:78 +0x4c
  main.NewEcho.Sessions.func5.1()
...

Previous read at 0x00c000bb0950 by goroutine 130:
  github.com/gorilla/securecookie.(*SecureCookie).Decode()
      /Users/kotaro_abe/pkg/mod/github.com/gorilla/[email protected]/securecookie.go:339 +0x32c
  github.com/gorilla/securecookie.DecodeMulti()
      /Users/kotaro_abe/pkg/mod/github.com/gorilla/[email protected]/securecookie.go:594 +0x11c
  github.com/antonlindstrom/pgstore.(*PGStore).New()
      /Users/kotaro_abe/pkg/mod/github.com/antonlindstrom/[email protected]/pgstore.go:94 +0x374
  github.com/gorilla/sessions.(*Registry).Get()
      /Users/kotaro_abe/pkg/mod/github.com/gorilla/[email protected]/sessions.go:139 +0xf8
  github.com/antonlindstrom/pgstore.(*PGStore).Get()
      /Users/kotaro_abe/pkg/mod/github.com/antonlindstrom/[email protected]/pgstore.go:78 +0x4c
  main.NewEcho.Sessions.func5.1()
...

Goroutine 64 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/go/src/net/http/server.go:3285 +0x674
  github.com/labstack/echo/v4.(*Echo).Start()
      /Users/kotaro_abe/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:686 +0x11c
...

Goroutine 130 (running) created at:
  net/http.(*Server).Serve()
      /usr/local/go/src/net/http/server.go:3285 +0x674
  github.com/labstack/echo/v4.(*Echo).Start()
      /Users/kotaro_abe/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:686 +0x11c
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions