Race Condition in put when use_sudo=True #1555
Closed
Milestone
Comments
The pseudo-random hash currently depends on the destination path, not on the file content. So this is not as bad as it sounds: this doesn't happen for putting identical files to different places simultaneously, this happens for putting multiple files (could be different content) to the same place simultaneously. Using a random temp file makes it so that all of the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Abstract
There is a race in
put
, and theuse_sudo=True
, and writing a file with the same content from multiple connections concurrently.Steps To Reproduce
Run this script concurrently:
It seems that the name of temporary file created is a hash of the host string and the file content. When
put
ing files with the same content to the same host, there is a race for themv
operation, and with non-zero probability only the first operation will succeed.Adding a random string to https://github.com/fabric/fabric/blob/master/fabric/sftp.py#L164 seems to make this script work without problems (e.g.
hasher.update(uuid.uuid4().hex)
).The text was updated successfully, but these errors were encountered: