Skip to content

Race condition allows duplicate project names #660

@katiepeters

Description

@katiepeters

Describe the bug
If ProjectsApi.CreateGroup(ctx, newProject).Execute() gets called multiple times close together (ex. in concurrent goroutines) with the same project name, multiple projects with the same name get created.

Image

Ex:

go func() {
	newProject := admin.NewGroupWithDefaults()
	newProject.SetName("duplicate")
	newProject.SetOrgId(atlasOrgID)
	newProject.SetRegionUsageRestrictions("NONE")
	_, _, err := atlasClient.ProjectsApi.CreateGroup(ctx, newProject).Execute()
	if err != nil {
		// One of these should fail.
	}
}()

go func() {
	newProject := admin.NewGroupWithDefaults()
	newProject.SetName("duplicate")
	newProject.SetOrgId(atlasOrgID)
	newProject.SetRegionUsageRestrictions("NONE")
	_, _, err := atlasClient.ProjectsApi.CreateGroup(ctx, newProject).Execute()
	if err != nil {
		// One of these should fail.
	}
}()

Expected behavior
Only one project gets created. Any subsequent attempts return an error.

I understand that this is most likely not an issue with the SDK itself, but I was advised by support to put the bug report here.

Desktop (please complete the following information):

  • Lib Version: v20250312007.0.0

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