Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transferid collisions #3522

Closed
PVince81 opened this issue Jul 30, 2015 · 9 comments
Closed

Transferid collisions #3522

PVince81 opened this issue Jul 30, 2015 · 9 comments
Assignees
Labels

Comments

@PVince81
Copy link
Contributor

See owncloud/core#17956 (comment)

This was found by running "test_basicSync.py" on my environment (see initial steps).
It looks like two instances of sync client from the test are uploading the same file at the same time. Since the start time is the same, the transfer id is the same.
I suspect that the transfer id is based on the timestamp.

@LukasReschke suggested using a low secure random instead.

This was with:

  • owncloud-client-1.8.4-2.5.x86_64
  • openSUSE Factory
  • laptop has SSD and smashdir is a ramdisk (makes the whole thing faster)
  • server is ownCloud 8.1 (stable 8.1 branch)

@ogoffart @guruz

@LukasReschke
Copy link
Member

@LukasReschke suggested using a low secure random instead.

That only in case https://github.com/owncloud/core/blob/c700f42b68f430e9c89ce97b92ea91323c9f6ed5/lib/private/filechunking.php#L151 is indeed used for that. No idea how that chunking really works… Looked at it soooooooo long ago 🙊

@PVince81
Copy link
Contributor Author

signature_split isn't used anywhere. It looks like it's very old code.

The transfer id is actually parsed from the file name sent by the client: https://github.com/owncloud/core/blob/c700f42b68f430e9c89ce97b92ea91323c9f6ed5/lib/private/filechunking.php#L36

@PVince81
Copy link
Contributor Author

I grepped the sync logs I saw that the transfer id 3657486019 appears in both the following logs:

  • creator-ocsync.step01.cnt000.log
  • loser-ocsync.step04.cnt000.log

@guruz pointed out at https://github.com/owncloud/client/blob/master/src/libsync/propagateupload.cpp#L256 and

qsrand(QTime::currentTime().msec());

Here is my Qt version in case it would affect the algo:
libQt5Core5-5.4.2-2.3.x86_64

@PVince81
Copy link
Contributor Author

@guruz advised me to add this in cmd.php's main:

qsrand(QTime::currentTime().msec() * QCoreApplication::applicationPid());

Now when run the smashbox test the collision is gone and all tests pass!

@PVince81
Copy link
Contributor Author

Fixed through 79d895e

@guruz backport ?

@guruz
Copy link
Contributor

guruz commented Jul 30, 2015

With the 2.0 beta coming out next week (hopefully) I don't think it's needed :)
thanks for spotting!

@guruz guruz added this to the 2.0 - Multi-account milestone Jul 30, 2015
@PVince81
Copy link
Contributor Author

@guruz if we don't it means smashbox tests will randomly fail in CI as it does now. Unless we switch CI directly to 2.0 once it's out.
@DeepDiver1975 what do you think ?

PVince81 pushed a commit that referenced this issue Jul 30, 2015
@guruz
Copy link
Contributor

guruz commented Jul 30, 2015

Cherry-picked into 1.8
65933d5

@DeepDiver1975
Copy link
Member

Cherry-picked into 1.8

THX - so I'll run ci with 1.8 branch build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants