Skip to content

create_dir_all is not thread safe #38045

@weiznich

Description

@weiznich
Contributor

For concurrent requests to create the same directory using create_dir_all it is possible that the request fails with Error { repr: Os { code: 17, message: "File exists" } because a second thread already has created that directory. The problem is caused by create_dir_all function in DirBuilder.

I see three solution for this problem:

  1. Document this behaviour
  2. Make create_dir_all
  3. Make create_dir_all ignoring this error?

Platform: Ubuntu 16.04 x86_64

Activity

durka

durka commented on Nov 28, 2016

@durka
Contributor

Duplicate of #33707.

alexcrichton

alexcrichton commented on Nov 28, 2016

@alexcrichton
Member

Indeed!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @durka@alexcrichton@weiznich@apasel422

        Issue actions

          create_dir_all is not thread safe · Issue #38045 · rust-lang/rust