Skip to content

Fix race condition in namespace directory creation

What does this MR do?

Fixes a race condition in lib/gitlab/shell.rb add_namespace method that can occur when multiple repos are created simultaneously for a new user. The namespace directory can be created in the time between checking for its existence and attempting to create it, which currently causes an error.

Are there points in the code the reviewer needs to double check?

No.

Why was this MR needed?

We have external tooling that creates repos for our users via API, sometimes several repos at a time. A new user hit a failure when simultaneously creating three repos due to the race condition addressed here.

Screenshots (if relevant)

N/A

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

None.

Merge request reports