Skip to content

Fix data race in TestDo_rateLimit_abortSleepContextCancelled on Windows #4055

@alexandear

Description

@alexandear

TestDo_rateLimit_abortSleepContextCancelled fails on Windows.

From https://github.com/google/go-github/actions/runs/22528888687/job/65265173190#step:4:14?target=https://github.com

testing .
==================
WARNING: DATA RACE
Read at 0x00c003edd998 by goroutine 5423:
  github.com/google/go-github/v84/github.TestDo_rateLimit_abortSleepContextCancelled()
      D:/a/go-github/go-github/github/github_test.go:1795 +0x454
  testing.tRunner()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2036 +0x1ca
  testing.(*T).Run.gowrap1()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2101 +0x38

Previous write at 0x00c003edd998 by goroutine 12533:
  github.com/google/go-github/v84/github.TestDo_rateLimit_abortSleepContextCancelled.func1()
      D:/a/go-github/go-github/github/github_test.go:1774 +0x86
  net/http.HandlerFunc.ServeHTTP()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2286 +0x47
  net/http.(*ServeMux).ServeHTTP()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2828 +0x242
  github.com/google/go-github/v84/github.setup.StripPrefix.func3()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2348 +0x4d3
  net/http.HandlerFunc.ServeHTTP()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2286 +0x47
  net/http.(*ServeMux).ServeHTTP()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2828 +0x242
  net/http.serverHandler.ServeHTTP()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:3311 +0x2a1
  net/http.(*conn).serve()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:2073 +0xda4
  net/http.(*Server).Serve.gowrap3()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:3464 +0x46

Goroutine 5423 (running) created at:
  testing.(*T).Run()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2101 +0xb2a
  testing.runTests.func1()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2585 +0x85
  testing.tRunner()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2036 +0x1ca
  testing.runTests()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2583 +0x9f7
  testing.(*M).Run()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/testing/testing.go:2443 +0xf4b
  main.main()
      _testmain.go:13486 +0x164

Goroutine 12533 (finished) created at:
  net/http.(*Server).Serve()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/server.go:3464 +0x889
  net/http/httptest.(*Server).goServe.func1()
      C:/hostedtoolcache/windows/go/1.26.0/x64/src/net/http/httptest/server.go:341 +0xb2
==================
--- FAIL: TestDo_rateLimit_abuseRateLimitError (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListCollaboratorsIter (0.01s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestReactionsService_ListIssueReactionsIter (0.01s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestDo_rateLimit_abortSleepContextCancelled (0.02s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact_unexpectedCode (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact_invalidOwner (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact_invalidRepo (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestActionsService_DownloadArtifact_StatusMovedPermanently_dontFollowRedirects (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListAppRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateRequiredStatusChecks_Contexts (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RenameBranch (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetBranchProtection (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ReplaceUserRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveTeamRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_AddTeamRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_OptionalSignaturesOnProtectedBranch (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_Contexts (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetRequiredStatusChecks_branchNotProtected (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveUserRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveRequiredStatusChecks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_AddAdminEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ReplaceAppRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListRequiredStatusChecksContexts (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ReplaceTeamRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_AddAppRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepository_UnmarshalJSON (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveAppRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateRequiredStatusChecks_Checks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemovePullRequestReviewEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListTeamRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListRequiredStatusChecksContexts_branchNotProtected (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RequireSignaturesOnProtectedBranch (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_Checks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveAdminEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_DisableDismissalRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetSignaturesProtectedBranch_branchNotProtected (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_RemoveBranchProtection (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_ListUserRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetAdminEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_EmptyChecks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetBranchProtection_branchNotProtected (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_AddUserRestrictions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_EmptyContexts (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetRequiredStatusChecks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetSignaturesProtectedBranch (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetPullRequestReviewEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdateBranchProtection_StrictNoChecks (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetBranch_BadJSONResponse (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_UpdatePullRequestReviewEnforcement (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetBranch_notFound (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestHookDelivery_ParsePayload (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRequiredReviewer_UnmarshalJSON (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_followRedirects (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_dontFollowRedirects (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_GetArchiveLink (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageVersion_GetBody (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_CompareCommits (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_CompareCommitsRaw_invalid (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_CompareCommitsRaw_patch (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageVersion_GetMetadata (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageNugetMetadata_Marshal (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageVersion_GetRawMetadata (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageVersion_GetBodyAsPackageVersionBody (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPullRequestReviewRequest_isComfortFadePreview (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoriesService_CompareCommitsRaw_diff (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCustomPropertyDefaultValueString (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCustomPropertyDefaultValueBool (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestValidatePayload_BadRequestBody (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestPackageNPMMetadata_Marshal (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCustomPropertyDefaultValueStrings (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestWithEnterpriseURLs (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRulesetRules (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestBranchRules (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestRepositoryRule (0.00s)
    testing.go:1712: race detected during execution of test
FAIL
coverage: 99.2% of statements
FAIL	github.com/google/go-github/v84/github	4.523s
	github.com/google/go-github/v84/test/fields		coverage: 0.0% of statements
?   	github.com/google/go-github/v84/test/integration	[no test files]
FAIL
testing example
	github.com/google/go-github/v84/example/actionpermissions		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/appengine		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/basicauth		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/codespaces/newreposecretwithxcrypto		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/codespaces/newusersecretwithxcrypto		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/commitpr		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/listenvironments		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/migrations		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/newfilewithappauth		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/newrepo		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/newreposecretwithxcrypto		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/otel		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/ratelimit		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/simple		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/tokenauth		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/topics		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/uploadreleaseassetfromrelease		coverage: 0.0% of statements
	github.com/google/go-github/v84/example/verifyartifact		coverage: 0.0% of statements
testing otel
ok  	github.com/google/go-github/v84/otel	1.504s	coverage: 100.0% of statements
testing scrape
ok  	github.com/google/go-github/scrape	1.148s	coverage: 59.4% of statements
	github.com/google/go-github/scrape/example/scrape		coverage: 0.0% of statements
testing tools
	tools/gen-release-notes		coverage: 0.0% of statements
ok  	tools/metadata	1.186s	coverage: 81.2% of statements
testing tools/check-structfield-settings
	github.com/google/go-github/v84/tools/check-structfield-settings		coverage: 0.0% of statements
testing tools/fmtpercentv
ok  	tools/fmtpercentv	4.404s	coverage: 81.2% of statements
testing tools/sliceofpointers
ok  	tools/sliceofpointers	1.773s	coverage: 94.7% of statements
testing tools/structfield
ok  	github.com/google/go-github/v84/tools/structfield	4.453s	coverage: 93.6% of statements

Full logs_58912318139.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions