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

Old chunking on new endpoint broken when using if-match header #28197

Closed
PVince81 opened this issue Jun 23, 2017 · 7 comments
Closed

Old chunking on new endpoint broken when using if-match header #28197

PVince81 opened this issue Jun 23, 2017 · 7 comments

Comments

@PVince81
Copy link
Contributor

Steps

  1. Login as admin "admin"
  2. Create a user "user1"
  3. Login as "user1"
  4. Create a file "data1.dat" with whatever contents.
  5. Share "data1.dat" with "admin".
  6. Log out
  7. Setup local desktop client for "admin"
  8. Wait for sync
  9. Replace the file "data1.dat" locally with a big one to trigger chunking

Expected result

Upload succeeds, original file keeps its file id and etag changes for both the file and the parent.

Actual result

With desktop client 2.3.2 using old chunking, getting "412 An If-Match header was specified and the resource did not exist":

{"reqId":"sFrpwigItQogTHW5WblS","level":0,"time":"2017-06-23T13:28:48+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3886638851-13-1","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}
{"reqId":"gvl4Qhlae2wIh7VHzOHt","level":0,"time":"2017-06-23T13:28:48+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3886638851-13-2","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}
{"reqId":"8zYlEnfzBMb1ChuIrY9M","level":0,"time":"2017-06-23T13:28:48+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3886638851-13-0","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}
{"reqId":"MKPYz2yrKVCVcwd7rkzS","level":0,"time":"2017-06-23T13:28:51+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3246638472-13-2","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}
{"reqId":"ETCSfrMC8JaUaMztJM7w","level":0,"time":"2017-06-23T13:28:51+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3246638472-13-1","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}
{"reqId":"gCtiCy0zbjov67Z2eIyp","level":0,"time":"2017-06-23T13:28:51+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/admin\/data1.dat-chunking-3246638472-13-0","message":"Exception: {\"Message\":\"HTTP\\\/1.1 412 An If-Match header was specified and the resource did not exist\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\PreconditionFailed\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(474): Sabre\\\\DAV\\\\Server->checkPreconditions(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(229): Sabre\\\\DAV\\\\Server->exec()\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/remote.php(165): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#5 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php\",\"Line\":1309,\"User\":\"admin\"}"}

With new chunking from ... wait a minute, why is client 2.3.2 using old chunking ?

Versions

OC 10.0 master

@PVince81
Copy link
Contributor Author

okay actually three cases to distinguish:

  1. old endpoint with old chunking: remote.php/webdav
  2. new endpoint with old chunking (which is what happens above): remote.php/dav/files/$user/
  3. new endpoint with new chunking: remote.php/uploads with MOVE to remote.php/dav/files/$user/

@PVince81
Copy link
Contributor Author

Also doesn't work on the PR #28160 which comes with many new tests covering all these chunk stuff. The difference is that we don't send If-Match headers there.

@PVince81
Copy link
Contributor Author

setting to high as it would break use cases where people share big files directly

@PVince81
Copy link
Contributor Author

If-Match fails when checking for the chunk file because the triggered code path doesn't resolve it to the real file.

Even weirder: when I overwrite an existing file that is not a received shared file, it uses the correct "uploads" endpoint:

127.0.0.1 - admin [23/Jun/2017:15:53:36 +0200] "MKCOL /owncloud/remote.php/dav/uploads/admin/1226433652 HTTP/1.1" 201 - "-" "Mozilla/5.0 (Linux) mirall/2.3.2"
127.0.0.1 - admin [23/Jun/2017:15:53:36 +0200] "PUT /owncloud/remote.php/dav/uploads/admin/1226433652/00000000 HTTP/1.1" 201 - "-" "Mozilla/5.0 (Linux) mirall/2.3.2"
127.0.0.1 - admin [23/Jun/2017:15:53:37 +0200] "PUT /owncloud/remote.php/dav/uploads/admin/1226433652/00000001 HTTP/1.1" 201 - "-" "Mozilla/5.0 (Linux) mirall/2.3.2"

@PVince81
Copy link
Contributor Author

Desktop client version owncloud-client-2.3.2-1.5.x86_64 on openSUSE Tumbleweed.

@PVince81 PVince81 changed the title Broken chunk upload for received file shares Old chunking on new endpoint broken Jun 23, 2017
@PVince81 PVince81 changed the title Old chunking on new endpoint broken Old chunking on new endpoint broken when using if-match header Jun 23, 2017
@PVince81
Copy link
Contributor Author

After investigating all this, the fix is to have the desktop client always use new chunking.

Then we ban old chunking from the new endpoint #28200 which is quicker than trying to fix this exact case.

@lock
Copy link

lock bot commented Jul 30, 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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants