Skip to content

testserver: racy access to DisableDefaultTestTenant #104500

@knz

Description

@knz

Describe the problem

This code in (ts *TestServer) maybeStartDefaultTestTenant:

  if err := base.CheckEnterpriseEnabled(ts.st, clusterID(), "SQL servers"); err != nil {
    ts.cfg.DisableDefaultTestTenant = true   // <- HERE
    return nil
  }

possibly races with the following code in (s *Server) makeSharedProcessTenantConfig:

  parentCfg := s.cfg   // <- HERE

The race is triggered when the following conditions hold simultaneously:

  • ccl.TestingEnableEnterprise() has not been called
  • a test server is started via serverutils.StartServer
  • concurrently, the test makes the server controller internally start a tenant server (eg as side effect of alter tenant start service shared)

These conditions are rather unlikely and currently only happen in configprofiles.TestDataDriven (this is the root cause of test failures #102800 and #102408.)

Expected behavior

I don't think it's safe/reasonable for the code in (ts *TestServer) maybeStartDefaultTestTenant to write to its ts.cfg.

I also don't think it's even necessary for this logic.

Jira issue: CRDB-28566
Epic: CRDB-18499

Metadata

Metadata

Assignees

Labels

A-multitenancyRelated to multi-tenancyA-testingTesting tools and infrastructureC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-multitenantIssues owned by the multi-tenant virtual team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions