Skip to content

flake: TestUpdateWorkspaceACL/CannotChangeOwnRole #1319

@flake-investigator

Description

@flake-investigator

CI Failure Details

CI Run Link: https://github.com/coder/coder/actions/runs/21516243469

Failed Job: test-go-race-pg

Commit Info:

  • SHA: e45635aab68197bc675d7d752d27c716d90b9b39
  • Author: Jake Howell
  • Date: 2026-01-30

Failure Signature

Job logs only include the gotestsum summary (no stack traces or assertion output present):

2026-01-30T12:54:09.6264799Z ==================
2026-01-30T12:54:09.6264923Z WARNING: DATA RACE
2026-01-30T12:54:09.6265071Z Write at 0x00000c84f71f by goroutine 88191:
2026-01-30T12:54:09.6265299Z   github.com/coder/coder/v2/coderd/rbac.SetWorkspaceACLDisabled()
2026-01-30T12:54:09.6265572Z       /home/runner/work/coder/coder/coderd/rbac/object.go:247 +0x30
2026-01-30T12:54:09.6265839Z   github.com/coder/coder/v2/coderd_test.TestUpdateWorkspaceACL.func4.1()
2026-01-30T12:54:09.6266131Z       /home/runner/work/coder/coder/coderd/workspaces_test.go:5199 +0xe
2026-01-30T12:54:09.6266282Z   testing.(*common).Cleanup.func1()
2026-01-30T12:54:09.6266575Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1308 +0x168
2026-01-30T12:54:09.6266723Z   testing.(*common).runCleanup()
2026-01-30T12:54:09.6267025Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1572 +0x225
2026-01-30T12:54:09.6267163Z   testing.tRunner.func2()
2026-01-30T12:54:09.6267445Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1928 +0x4c
2026-01-30T12:54:09.6267582Z   runtime.deferreturn()
2026-01-30T12:54:09.6267852Z       /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/panic.go:589 +0x5d
2026-01-30T12:54:09.6268078Z   github.com/coder/coder/v2/coderd/cryptokeys.StartRotator()
2026-01-30T12:54:09.6268364Z       /home/runner/work/coder/coder/coderd/cryptokeys/rotate.go:72 +0x5f0
2026-01-30T12:54:09.6268515Z   github.com/coder/coder/v2/coderd.New()
2026-01-30T12:54:09.6268769Z       /home/runner/work/coder/coder/coderd/coderd.go:577 +0x4a9b
2026-01-30T12:54:09.6268923Z   github.com/coder/coder/v2/coderd.New()
2026-01-30T12:54:09.6269221Z       /home/runner/work/coder/coder/coderd/coderd.go:542 +0x416c
2026-01-30T12:54:09.6269365Z   github.com/coder/coder/v2/coderd.New()
2026-01-30T12:54:09.6269626Z       /home/runner/work/coder/coder/coderd/coderd.go:531 +0x3f0c
2026-01-30T12:54:09.6269772Z   github.com/coder/coder/v2/coderd.New()
2026-01-30T12:54:09.6270006Z       /home/runner/work/coder/coder/coderd/coderd.go:520 +0x3af5
2026-01-30T12:54:09.6270221Z   github.com/coder/coder/v2/coderd/coderdtest.NewWithAPI()
2026-01-30T12:54:09.6270519Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:635 +0xf4
2026-01-30T12:54:09.6270712Z   github.com/coder/coder/v2/coderd/coderdtest.NewOptions()
2026-01-30T12:54:09.6271011Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:310 +0x1512
2026-01-30T12:54:09.6271198Z   github.com/coder/coder/v2/coderd/coderdtest.NewOptions()
2026-01-30T12:54:09.6271534Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:304 +0x1399
2026-01-30T12:54:09.6271726Z   github.com/coder/coder/v2/coderd/coderdtest.NewWithAPI()
2026-01-30T12:54:09.6272015Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:633 +0xd7
2026-01-30T12:54:09.6272217Z   github.com/coder/coder/v2/coderd/coderdtest.newWithCloser()
2026-01-30T12:54:09.6272530Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:231 +0x3b
2026-01-30T12:54:09.6272716Z   github.com/coder/coder/v2/coderd/coderdtest.New()
2026-01-30T12:54:09.6273007Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:199 +0x27
2026-01-30T12:54:09.6273243Z   github.com/coder/coder/v2/coderd_test.TestUpdateWorkspaceACL.func4()
2026-01-30T12:54:09.6273523Z       /home/runner/work/coder/coder/coderd/workspaces_test.go:5203 +0x284
2026-01-30T12:54:09.6273649Z   testing.tRunner()
2026-01-30T12:54:09.6273951Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1934 +0x21c
2026-01-30T12:54:09.6274090Z   testing.(*T).Run.gowrap1()
2026-01-30T12:54:09.6274383Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1997 +0x44
2026-01-30T12:54:09.6274514Z
2026-01-30T12:54:09.6274674Z Previous read at 0x00000c84f71f by goroutine 90218:
2026-01-30T12:54:09.6274932Z   github.com/coder/coder/v2/coderd/database.WorkspaceTable.RBACObject()
2026-01-30T12:54:09.6275232Z       /home/runner/work/coder/coder/coderd/database/modelmethods.go:438 +0x39e
2026-01-30T12:54:09.6275460Z   github.com/coder/coder/v2/coderd/database.Workspace.RBACObject()
2026-01-30T12:54:09.6275756Z       /home/runner/work/coder/coder/coderd/database/modelmethods.go:407 +0x337
2026-01-30T12:54:09.6275989Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6276290Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:452 +0x604
2026-01-30T12:54:09.6276511Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6276793Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:440 +0x565
2026-01-30T12:54:09.6277009Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6277289Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:440 +0x565
2026-01-30T12:54:09.6277523Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6277806Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:440 +0x565
2026-01-30T12:54:09.6278019Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6278300Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:440 +0x565
2026-01-30T12:54:09.6278517Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6278816Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:440 +0x565
2026-01-30T12:54:09.6279035Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).monitor()
2026-01-30T12:54:09.6279319Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:407 +0x13b
2026-01-30T12:54:09.6279580Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).start.func2()
2026-01-30T12:54:09.6279859Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:360 +0x91
2026-01-30T12:54:09.6280137Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).start.gowrap2()
2026-01-30T12:54:09.6280415Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:361 +0x4f
2026-01-30T12:54:09.6280466Z
2026-01-30T12:54:09.6280597Z Goroutine 88191 (running) created at:
2026-01-30T12:54:09.6280728Z   testing.(*T).Run()
2026-01-30T12:54:09.6281034Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1997 +0x9d2
2026-01-30T12:54:09.6281252Z   github.com/coder/coder/v2/coderd_test.TestUpdateWorkspaceACL()
2026-01-30T12:54:09.6281526Z       /home/runner/work/coder/coder/coderd/workspaces_test.go:5195 +0xa4
2026-01-30T12:54:09.6281649Z   testing.tRunner()
2026-01-30T12:54:09.6281955Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1934 +0x21c
2026-01-30T12:54:09.6282106Z   testing.(*T).Run.gowrap1()
2026-01-30T12:54:09.6282385Z       /opt/hostedtoolcache/go/1.25.6/x64/src/testing/testing.go:1997 +0x44
2026-01-30T12:54:09.6282440Z
2026-01-30T12:54:09.6282570Z Goroutine 90218 (running) created at:
2026-01-30T12:54:09.6282787Z   github.com/coder/coder/v2/coderd.(*agentConnectionMonitor).start()
2026-01-30T12:54:09.6283104Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:358 +0x2ab
2026-01-30T12:54:09.6283324Z   github.com/coder/coder/v2/coderd.(*API).startAgentYamuxMonitor()
2026-01-30T12:54:09.6283607Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:250 +0x8e4
2026-01-30T12:54:09.6283808Z   github.com/coder/coder/v2/coderd.(*API).workspaceAgentRPC()
2026-01-30T12:54:09.6284102Z       /home/runner/work/coder/coder/coderd/workspaceagentsrpc.go:126 +0x1a1a
2026-01-30T12:54:09.6284334Z   github.com/coder/coder/v2/coderd.(*API).workspaceAgentRPC-fm()
2026-01-30T12:54:09.6284561Z       <autogenerated>:1 +0x51
2026-01-30T12:54:09.6284720Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6285000Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6285285Z   github.com/coder/coder/v2/coderd.New.func14.13.1.1.WithStaticProfilingLabels.1.1.1()
2026-01-30T12:54:09.6285562Z       /home/runner/work/coder/coder/coderd/httpmw/pprof.go:39 +0xe1
2026-01-30T12:54:09.6285688Z   runtime/pprof.Do()
2026-01-30T12:54:09.6285992Z       /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/pprof/runtime.go:51 +0x111
2026-01-30T12:54:09.6286272Z   github.com/coder/coder/v2/coderd.New.func14.13.1.1.WithStaticProfilingLabels.1.1()
2026-01-30T12:54:09.6286536Z       /home/runner/work/coder/coder/coderd/httpmw/pprof.go:37 +0x138
2026-01-30T12:54:09.6286693Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6286973Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6287157Z   github.com/go-chi/chi/v5.(*ChainHandler).ServeHTTP()
2026-01-30T12:54:09.6287457Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/chain.go:31 +0x61
2026-01-30T12:54:09.6287624Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP()
2026-01-30T12:54:09.6287926Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:478 +0x581
2026-01-30T12:54:09.6288095Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP-fm()
2026-01-30T12:54:09.6288247Z       <autogenerated>:1 +0x51
2026-01-30T12:54:09.6288390Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6288667Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6288974Z   github.com/coder/coder/v2/coderd.New.ExtractWorkspaceAgentAndLatestBuild.func28.1()
2026-01-30T12:54:09.6289277Z       /home/runner/work/coder/coder/coderd/httpmw/workspaceagent.go:137 +0x6a6
2026-01-30T12:54:09.6289563Z   github.com/coder/coder/v2/coderd.New.ExtractWorkspaceAgentAndLatestBuild.func28.1()
2026-01-30T12:54:09.6289861Z       /home/runner/work/coder/coder/coderd/httpmw/workspaceagent.go:112 +0x444
2026-01-30T12:54:09.6290036Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6290334Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6290527Z   github.com/go-chi/chi/v5.(*Mux).ServeHTTP()
2026-01-30T12:54:09.6290821Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:73 +0x6f6
2026-01-30T12:54:09.6290986Z   github.com/go-chi/chi/v5.(*Mux).Mount.func1()
2026-01-30T12:54:09.6291278Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:325 +0x4be
2026-01-30T12:54:09.6291437Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6291712Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6291869Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP()
2026-01-30T12:54:09.6292153Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:478 +0x581
2026-01-30T12:54:09.6292315Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP-fm()
2026-01-30T12:54:09.6292514Z       <autogenerated>:1 +0x51
2026-01-30T12:54:09.6292658Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6292927Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6293081Z   github.com/go-chi/chi/v5.(*Mux).ServeHTTP()
2026-01-30T12:54:09.6293362Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:73 +0x6f6
2026-01-30T12:54:09.6293560Z   github.com/go-chi/chi/v5.(*Mux).Mount.func1()
2026-01-30T12:54:09.6293840Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:325 +0x4be
2026-01-30T12:54:09.6293982Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6294258Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6294490Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP()
2026-01-30T12:54:09.6294801Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:478 +0x581
2026-01-30T12:54:09.6294967Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP-fm()
2026-01-30T12:54:09.6295117Z       <autogenerated>:1 +0x51
2026-01-30T12:54:09.6295263Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6295539Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6295830Z   github.com/coder/coder/v2/coderd/httpmw.ReportCLITelemetry.func1.1.deferwrap1()
2026-01-30T12:54:09.6296113Z       /home/runner/work/coder/coder/coderd/httpmw/clitelemetry.go:42 +0x6f
2026-01-30T12:54:09.6296250Z   runtime.deferreturn()
2026-01-30T12:54:09.6296522Z       /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/panic.go:589 +0x5d
2026-01-30T12:54:09.6296664Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6296947Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6297108Z   github.com/go-chi/chi/v5.(*Mux).ServeHTTP()
2026-01-30T12:54:09.6297401Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:73 +0x6f6
2026-01-30T12:54:09.6297564Z   github.com/go-chi/chi/v5.(*Mux).Mount.func1()
2026-01-30T12:54:09.6297851Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:325 +0x4be
2026-01-30T12:54:09.6298010Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6298284Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6298438Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP()
2026-01-30T12:54:09.6298727Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:478 +0x581
2026-01-30T12:54:09.6298885Z   github.com/go-chi/chi/v5.(*Mux).routeHTTP-fm()
2026-01-30T12:54:09.6299035Z       <autogenerated>:1 +0x51
2026-01-30T12:54:09.6299192Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6299466Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6299669Z   github.com/justinas/nosurf.(*CSRFHandler).handleSuccess()
2026-01-30T12:54:09.6299985Z       /home/runner/go/pkg/mod/github.com/justinas/nosurf@v1.2.0/handler.go:178 +0x541
2026-01-30T12:54:09.6300170Z   github.com/justinas/nosurf.(*CSRFHandler).ServeHTTP()
2026-01-30T12:54:09.6300493Z       /home/runner/go/pkg/mod/github.com/justinas/nosurf@v1.2.0/handler.go:151 +0x504
2026-01-30T12:54:09.6300688Z   github.com/coder/coder/v2/coderd.New.func5.1()
2026-01-30T12:54:09.6300961Z       /home/runner/work/coder/coder/coderd/coderd.go:933 +0x191
2026-01-30T12:54:09.6301108Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6301388Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6301621Z   github.com/go-chi/cors.(*Cors).Handler-fm.(*Cors).Handler.func1()
2026-01-30T12:54:09.6301935Z       /home/runner/go/pkg/mod/github.com/go-chi/cors@v1.2.1/cors.go:228 +0x23c
2026-01-30T12:54:09.6302075Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6302347Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6302536Z   github.com/coder/coder/v2/coderd/httpmw.Cors.func1.1()
2026-01-30T12:54:09.6302816Z       /home/runner/work/coder/coder/coderd/httpmw/cors.go:89 +0x19c
2026-01-30T12:54:09.6302984Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6303255Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6303493Z   github.com/coder/coder/v2/coderd.New.(*Server).HandleSubdomain.func32.1()
2026-01-30T12:54:09.6303794Z       /home/runner/work/coder/coder/coderd/workspaceapps/proxy.go:435 +0x11c
2026-01-30T12:54:09.6303978Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6304249Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6304410Z   github.com/coder/coder/v2/coderd.New.func4.1()
2026-01-30T12:54:09.6304738Z       /home/runner/work/coder/coder/coderd/coderd.go:916 +0x1e1
2026-01-30T12:54:09.6304875Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6305163Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6305390Z   github.com/coder/coder/v2/coderd/httpmw.Prometheus.func1.1()
2026-01-30T12:54:09.6305676Z       /home/runner/work/coder/coder/coderd/httpmw/prometheus.go:89 +0x523
2026-01-30T12:54:09.6305828Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6306111Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6306335Z   github.com/coder/coder/v2/coderd/httpmw.HTTPRoute.func1()
2026-01-30T12:54:09.6306618Z       /home/runner/work/coder/coder/coderd/httpmw/httproute.go:43 +0x24a
2026-01-30T12:54:09.6306771Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6307046Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6307280Z   github.com/coder/coder/v2/coderd/rbac/rolestore.CustomRoleMW.func1()
2026-01-30T12:54:09.6307603Z       /home/runner/work/coder/coder/coderd/rbac/rolestore/rolestore.go:23 +0x1e4
2026-01-30T12:54:09.6307748Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6308028Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6308229Z   github.com/coder/coder/v2/coderd.singleSlashMW.func1()
2026-01-30T12:54:09.6308484Z       /home/runner/work/coder/coder/coderd/coderd.go:2188 +0x292
2026-01-30T12:54:09.6308646Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6308923Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6309107Z   github.com/coder/coder/v2/coderd.New.Logger.func31.1()
2026-01-30T12:54:09.6309410Z       /home/runner/work/coder/coder/coderd/httpmw/loggermw/logger.go:106 +0x7e4
2026-01-30T12:54:09.6309556Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6309843Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6310062Z   github.com/coder/coder/v2/coderd.New.ExtractRealIP.func30.1()
2026-01-30T12:54:09.6310335Z       /home/runner/work/coder/coder/coderd/httpmw/realip.go:50 +0x209
2026-01-30T12:54:09.6310483Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6310754Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6310986Z   github.com/coder/coder/v2/coderd/httpmw.AttachRequestID.func1()
2026-01-30T12:54:09.6311295Z       /home/runner/work/coder/coder/coderd/httpmw/requestid.go:38 +0x677
2026-01-30T12:54:09.6311455Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6311758Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6311964Z   github.com/coder/coder/v2/coderd/tracing.Middleware.func1.1()
2026-01-30T12:54:09.6312245Z       /home/runner/work/coder/coder/coderd/tracing/httpmw.go:71 +0xf15
2026-01-30T12:54:09.6312392Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6312665Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6312907Z   github.com/coder/coder/v2/coderd/tracing.StatusWriterMiddleware.func1()
2026-01-30T12:54:09.6313202Z       /home/runner/work/coder/coder/coderd/tracing/status_writer.go:39 +0xf3
2026-01-30T12:54:09.6313365Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6313665Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6313904Z   github.com/coder/coder/v2/coderd/httpmw.WithProfilingLabels.func1.1()
2026-01-30T12:54:09.6314170Z       /home/runner/work/coder/coder/coderd/httpmw/pprof.go:27 +0x1a9
2026-01-30T12:54:09.6314305Z   runtime/pprof.Do()
2026-01-30T12:54:09.6314689Z       /opt/hostedtoolcache/go/1.25.6/x64/src/runtime/pprof/runtime.go:51 +0x111
2026-01-30T12:54:09.6314957Z   github.com/coder/coder/v2/coderd/httpmw.WithProfilingLabels.func1()
2026-01-30T12:54:09.6315217Z       /home/runner/work/coder/coder/coderd/httpmw/pprof.go:25 +0x378
2026-01-30T12:54:09.6315361Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6315636Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6315846Z   github.com/coder/coder/v2/coderd.New.Recover.func29.1()
2026-01-30T12:54:09.6316086Z       /home/runner/work/coder/coder/httpmw/recover.go:44 +0x141
2026-01-30T12:54:09.6316232Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6316512Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6316741Z   github.com/coder/coder/v2/coderd.New.RecordAuthzChecks.func19.1()
2026-01-30T12:54:09.6317025Z       /home/runner/work/coder/coder/coderd/httpmw/authz.go:60 +0xc8
2026-01-30T12:54:09.6317176Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6317456Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6317622Z   github.com/go-chi/chi/v5.(*Mux).ServeHTTP()
2026-01-30T12:54:09.6317921Z       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.2/mux.go:90 +0x67e
2026-01-30T12:54:09.6318156Z   github.com/coder/coder/v2/coderd/coderdtest.NewOptions.func3()
2026-01-30T12:54:09.6318451Z       /home/runner/work/coder/coder/coderd/coderdtest/coderdtest.go:459 +0x94
2026-01-30T12:54:09.6318594Z   net/http.HandlerFunc.ServeHTTP()
2026-01-30T12:54:09.6318869Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2322 +0x47
2026-01-30T12:54:09.6319031Z   net/http.serverHandler.ServeHTTP()
2026-01-30T12:54:09.6319337Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:3340 +0x2a1
2026-01-30T12:54:09.6319469Z   net/http.(*conn).serve()
2026-01-30T12:54:09.6319753Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:2109 +0xda4
2026-01-30T12:54:09.6319902Z   net/http.(*Server).Serve.gowrap3()
2026-01-30T12:54:09.6320180Z       /opt/hostedtoolcache/go/1.25.6/x64/src/net/http/server.go:3493 +0x4f
2026-01-30T12:54:09.6320316Z ==================

Root Cause Hypothesis

A data race on the global workspaceACLDisabled atomic variable.

The Race:

  1. Writer (Goroutine 88191): Test cleanup at workspaces_test.go:5199 calls SetWorkspaceACLDisabled() to restore the previous state
  2. Reader (Goroutine 90218): Background agent connection monitor calls WorkspaceTable.RBACObject()WorkspaceACLDisabled() to check if ACLs are disabled

The Problem:

While the code uses atomic.Bool (which is race-safe for individual operations), the test pattern is flawed:

prevWorkspaceACLDisabled := rbac.WorkspaceACLDisabled()
rbac.SetWorkspaceACLDisabled(false)
t.Cleanup(func() { rbac.SetWorkspaceACLDisabled(prevWorkspaceACLDisabled) })

The cleanup runs while the test server is still running with active background goroutines (agent connection monitor) that are reading this global state.

Timeline:

  1. Test starts, sets WorkspaceACLDisabled = false
  2. Test creates server with agent connection monitor goroutine
  3. Test completes, cleanup begins
  4. Cleanup writes to global (restoring previous value)
  5. Agent monitor reads from global (still active!)
  6. Race detector triggers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions