Skip to content

test(archtest): the recursion pin's load can trip a go/types data race #855

Open

Description

@OmarAlJarrah

Problem

loweringCallGraph (internal/archtest/recursion_test.go) type-checks the four lowering packages in one packages.Load call:

  • compilers/openapi
  • compilers/openapi/internal/auth
  • compilers/openapi/internal/operation
  • compilers/openapi/internal/schema

go/packages type-checks every package whose imports are done at the same time, one checker per package. auth and schema import neither each other nor the other two, so their checkers can run concurrently.

Go 1.27.2's go/types has a data race between concurrent checkers that share an imported package (golang/go#81122). Checker.isComplete reads Named.fromRHS with no lock, while another checker's Named.unpack writes it as it expands a generic instance from that package. The fix (golang/go#81871) is not in any release. Under -race, which make coverage and CI use, the race fails every test running in the binary at that moment.

#837's first version loaded ir and the whole compilers/openapi tree in one call this way. Its compilers/openapi tests failed 1 run in 15 under make coverage's flags, with Named.unpack against Checker.isComplete inside packages.(*loader).loadPackage. archtest's load has the same shape with fewer independent roots. 40 isolated runs of the recursion pin on main at a2530c3 did not trip it, so it is rare, not impossible.

Expected

No packages.Load call in the test suite type-checks two packages at once. Either would do:

Acceptance

  • The recursion pin's load never has two roots that are independent of each other.
  • The pin still reddens on a planted cycle within a package, and still records the calls from one lowering package into another.

Activity

  1. added
    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formats
    on Oct 19, 2026
  2. fuad-daoud commented on Nov 2, 2026

    @fuad-daoud
    Collaborator

    Once #1311 lands, CI no longer runs internal/archtest under -race: it is not on scripts/race-packages.txt, because nothing in it runs morphic code concurrently, which is what the list's rule counts. So this go/types race can no longer fail the gate. The fix is still needed for anyone running archtest under -race locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formats

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions