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

PROPPATCH updates same properties multiple times #32660

Open
PVince81 opened this issue Sep 10, 2018 · 4 comments
Open

PROPPATCH updates same properties multiple times #32660

PVince81 opened this issue Sep 10, 2018 · 4 comments
Milestone

Comments

@PVince81
Copy link
Contributor

Steps

  1. Create a file "proppatch.xml"
<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:"><D:set><D:prop><somename xmlns="http://example.com/alpha">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/beta">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/gamma">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/delta">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/epsilon">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/zeta">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/eta">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/theta">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/iota">manynsvalue</somename></D:prop></D:set>
<D:set><D:prop><somename xmlns="http://example.com/kappa">manynsvalue</somename></D:prop></D:set>
</D:propertyupdate>
  1. Create a folder "test"
  2. Set a breakpoint in FileCustomPropertiesBackend->updateProperties()
  3. curl -u admin:admin -X PROPPATCH -H "Content-Type: text/xml" --data-binary "@proppatch.xml" "http://localhost/owncloud/remote.php/webdav/test"

Expected result

Only a single call to updateProperties()

Actual

Multiple calls, despite the fact that we already have all properties in the first call.
It seems that there are as many callback as there are properties.

0  OCA\DAV\DAV\FileCustomPropertiesBackend->updateProperties() /srv/www/htdocs/owncloud/apps/dav/lib/DAV/FileCustomPropertiesBackend.php:157
1  OCA\DAV\DAV\FileCustomPropertiesBackend->OCA\DAV\DAV\{closure}() /srv/www/htdocs/owncloud/apps/dav/lib/DAV/AbstractCustomPropertiesBackend.php:206
2  Sabre\DAV\PropPatch->doCallBackMultiProp() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/PropPatch.php:317
3  Sabre\DAV\PropPatch->commit() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/PropPatch.php:245
4  OCA\DAV\Connector\Sabre\Server->updateProperties() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/Server.php:1265
5  Sabre\DAV\CorePlugin->httpPropPatch() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/CorePlugin.php:385
6  call_user_func_array:{/srv/www/htdocs/owncloud/lib/composer/sabre/event/lib/EventEmitterTrait.php:105}() /srv/www/htdocs/owncloud/lib/composer/sabre/event/lib/EventEmitterTrait.php:105
7  OCA\DAV\Connector\Sabre\Server->emit() /srv/www/htdocs/owncloud/lib/composer/sabre/event/lib/EventEmitterTrait.php:105
8  OCA\DAV\Connector\Sabre\Server->invokeMethod() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/Server.php:479
9  OCA\DAV\Connector\Sabre\Server->exec() /srv/www/htdocs/owncloud/lib/composer/sabre/dav/lib/DAV/Server.php:254
10 require_once()  /srv/www/htdocs/owncloud/apps/dav/appinfo/v1/webdav.php:64
11 {main}          /srv/www/htdocs/owncloud/remote.php:165

Version

OC 10.0.10 RC1

Doing this could reduce performance. However, updating file properties with PROPPATCH is hopefully rare. I do wonder if mounting Webdav as Windows drive have more property updates...

Found while investigating Oracle issue: #32639 (comment)

cc @VicDeo

@PVince81
Copy link
Contributor Author

Seems that this code https://github.com/owncloud/core/blob/v10.0.10RC1/apps/dav/lib/DAV/AbstractCustomPropertiesBackend.php#L205 that calls handleRemaining is making Sabre create one callback per property instead of using a single callback for all.

We might need to use a different approach/method here.

@VicDeo
Copy link
Member

VicDeo commented Sep 10, 2018

well, it was the same way before me

public function propPatch($path, PropPatch $propPatch) {

@PVince81
Copy link
Contributor Author

yeah, I also see this used that way in some Sabre's properties backend, so wonder if it's a Sabre bug...

@ownclouders
Copy link
Contributor

GitMate.io thinks possibly related issues are #20661 (Update), #21366 (Update), #19642 (Can not download multiple times from public page), #14835 (Share dialog shows the same user multiple times), and #15477 (When updating).

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

No branches or pull requests

4 participants