You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Two pushes of the same file at about the same time result in no changes in the etag. #7802
changed the title [-]Two files pushed at the same time have the the same etag.[/-][+]Two pushes of the same file at about the same time result in no changes in the etag.[/+]on Mar 19, 2014
And there is a big red warning on the documentation:
Warning
This function does not create random nor unpredictable string. This function must not be used for
security purposes. Use cryptographically secure random function/generator and cryptographically
secure hash functions to create unpredictable secure ID.
No, this was running the client tests perl scripts.
the perl script is running some commands to upload files and then we sync.
There must be more than a µs between the two calls.
(about 400ms according to the wireshark timing)
Not directly related but it reminds me of a time where our unit tests were using the current time() timestamp value and when the machine was too fast, the same timestamp would come out and cause trouble.
Will generateRandomBytes() affect performance in any way (compared to uniqid) ?
I see that it first uses openssl if available, else /dev/urandom (on Linux), else a custom algorithm.
Activity
karlitschek commentedon Mar 19, 2014
Hmm. I´m not sure the server guarantees that etags are unique between files. @dragotin What do you think?
ogoffart commentedon Mar 19, 2014
I Forgot to mention that it is the same file.
[-]Two files pushed at the same time have the the same etag.[/-][+]Two pushes of the same file at about the same time result in no changes in the etag.[/+]dragotin commentedon Mar 19, 2014
The same etag for two subsequente PUTs on the same file is a bug of death. For two different files, it would probably be ok, but still not nice.
DeepDiver1975 commentedon Mar 19, 2014
The etag is generated using uniqid() - http://php.net/manual/en/function.uniqid.php
And there is a big red warning on the documentation:
DeepDiver1975 commentedon Mar 19, 2014
DeepDiver1975 commentedon Mar 19, 2014
Does that mean if one executes uniqid() in the same microsecond on two different php processes it can return the same value?
@ogoffart this occurred while testing parallel upload I assume?
ogoffart commentedon Mar 19, 2014
No, this was running the client tests perl scripts.
the perl script is running some commands to upload files and then we sync.
There must be more than a µs between the two calls.
(about 400ms according to the wireshark timing)
DeepDiver1975 commentedon Mar 19, 2014
in this case I assume a server side issue where we use a not-yet-updated etag
DeepDiver1975 commentedon Mar 20, 2014
I'll take care of this
DeepDiver1975 commentedon Mar 20, 2014
uniqid() has some know limitation - we shall replace it with e.g. \OC_Util::generateRandomBytes(13)
But this is not the root of this issue.
PVince81 commentedon Mar 20, 2014
Not directly related but it reminds me of a time where our unit tests were using the current time() timestamp value and when the machine was too fast, the same timestamp would come out and cause trouble.
Will
generateRandomBytes()affect performance in any way (compared to uniqid) ?I see that it first uses openssl if available, else /dev/urandom (on Linux), else a custom algorithm.
PVince81 commentedon May 6, 2014
@DeepDiver1975 did you find further useful information ?
karlitschek commentedon Dec 5, 2014
@DeepDiver1975 Is this still valid?
DeepDiver1975 commentedon Mar 20, 2015
@ogoffart still an issue? we changed the etag generation function in OC8+ - I'd assume this issue is solved by now.
PVince81 commentedon Mar 23, 2015
@jnfrmarks this should be testable somehow with smashbox (and a bit of timing luck)
PVince81 commentedon Jun 22, 2015
Hopefully solvable with high level file locking: #16237
MorrisJobke commentedon Dec 11, 2015
Please reopen this if this still happens with high level file locking enabled.
lock commentedon Aug 7, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.