files:transfer-ownership command does not work in some scenarios with shares #23686

Closed
davitol opened this Issue Mar 31, 2016 · 23 comments

Projects

None yet

6 participants

@davitol
Contributor
davitol commented Mar 31, 2016

Steps to reproduce

  1. Create 3 oC users, user1, user2 and user3
  2. Log in with user1
  3. Create a file.txt
  4. Share the file with user2 and user3
  5. As admin via CLI run --> sudo -u www-data ./occ files:transfer-ownership user1 user2

Expected behaviour

The ownership of files should be transferred from user1 to user2

Actual behaviour

An error is shown and the server is no longer available for user2 and user3

Server configuration

Operating system:
Ubuntu 14.04

Web server:
Apache

Database:
MySQL

PHP version:
5.5.9

ownCloud version: "9.0.1.1","versionstring":"9.0.1 RC1","edition":"Enterprise"}

Updated from an older ownCloud or fresh install:
Fresh

List of activated apps:
Enabled:

  • activity: 2.2.1
  • admin_audit: 0.7
  • comments: 0.2
  • dav: 0.1.6
  • enterprise_key: 0.1.0
  • federatedfilesharing: 0.1.0
  • federation: 0.0.4
  • files: 1.4.4
  • files_external: 0.5.2
  • files_pdfviewer: 0.8
  • files_sharing: 0.9.1
  • files_texteditor: 2.1
  • files_trashbin: 0.8.0
  • files_versions: 1.2.0
  • files_videoplayer: 0.9.8
  • firewall: 2.3.0
  • firstrunwizard: 1.1
  • gallery: 14.5.0
  • notifications: 0.2.3
  • provisioning_api: 0.4.1
  • systemtags: 0.2
  • templateeditor: 0.1
  • updatenotification: 0.1.0
  • windows_network_drive: 0.2.33
  • workflow: 0.1.3
    Disabled:
  • announcementcenter
  • encryption
  • external
  • files_antivirus
  • files_drop
  • files_ldap_home
  • objectstore
  • password_policy
  • sharepoint
  • user_external
  • user_ldap
  • user_shibboleth

The content of config/config.php:


Are you using external storage, if yes which one: local/smb/sftp/...
No

Are you using encryption:
No

Logs

{"reqId":"g\/hlx\/ztIOkoGpA6Ztp7","remoteAddr":"","app":"no app in context","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\"Message\":\"File with id \\\"21\\\" has not been found.\",\"Code\":0,\"Trace\":\"#0 \\\/opt\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/sharedstorage.php(90): OC\\\\Files\\\\View->getPath(21)\\n#1 \\\/opt\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/sharedstorage.php(581): OC\\\\Files\\\\Storage\\\\Shared->init()\\n#2 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(381): OC\\\\Files\\\\Storage\\\\Shared->getCache('', Object(OCA\\\\Workflow\\\\AutoTagging\\\\StorageWrapper))\\n#3 \\\/opt\\\/owncloud\\\/apps\\\/workflow\\\/autotagging\\\/storagewrapper.php(389): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getCache('', Object(OCA\\\\Workflow\\\\AutoTagging\\\\StorageWrapper))\\n#4 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1302): OCA\\\\Workflow\\\\AutoTagging\\\\StorageWrapper->getCache('')\\n#5 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/files\\\/node\\\/root.php(179): OC\\\\Files\\\\View->getFileInfo('\\\/user2')\\n#6 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/files\\\/node\\\/root.php(341): OC\\\\Files\\\\Node\\\\Root->get('\\\/user2')\\n#7 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/share20\\\/share.php(127): OC\\\\Files\\\\Node\\\\Root->getUserFolder('user2')\\n#8 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/share20\\\/manager.php(193): OC\\\\Share20\\\\Share->getNode()\\n#9 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/share20\\\/manager.php(652): OC\\\\Share20\\\\Manager->generalCreateChecks(Object(OC\\\\Share20\\\\Share))\\n#10 \\\/opt\\\/owncloud\\\/apps\\\/files\\\/command\\\/transferownership.php(218): OC\\\\Share20\\\\Manager->updateShare(Object(OC\\\\Share20\\\\Share))\\n#11 \\\/opt\\\/owncloud\\\/apps\\\/files\\\/command\\\/transferownership.php(114): OCA\\\\Files\\\\Command\\\\TransferOwnership->restoreShares(Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/opt\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OCA\\\\Files\\\\Command\\\\TransferOwnership->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/opt\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(840): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/opt\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OCA\\\\Files\\\\Command\\\\TransferOwnership), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#15 \\\/opt\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#16 \\\/opt\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(145): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#17 \\\/opt\\\/owncloud\\\/console.php(88): OC\\\\Console\\\\Application->run()\\n#18 \\\/opt\\\/owncloud\\\/occ(11): require_once('\\\/opt\\\/owncloud\\\/c...')\\n#19 {main}\",\"File\":\"\\\/opt\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php\",\"Line\":1639}","level":3,"time":"2016-03-31T08:12:31+00:00","method":"--","url":"--","user":"--"}

Client configuration

browser

Firefox

screen shot 2016-03-31 at 10 25 52

screen shot 2016-03-31 at 10 28 13

@davitol davitol added this to the 9.0.1-current-maintenance milestone Mar 31, 2016
@davitol
Contributor
davitol commented Mar 31, 2016
@PVince81
Collaborator
@rullzer
Contributor
rullzer commented Mar 31, 2016

Ok I just tried this on a clean master (and clean stable9) and it all works.

@davitol I don't really see how but could you try to disable apps? And see if that solves the issue?

@davitol
Contributor
davitol commented Mar 31, 2016

@rullzer I've retested it with only these apps enabled and it worked fine:

Enabled:

  • dav: 0.1.6
  • enterprise_key: 0.1.0
  • federatedfilesharing: 0.1.0
  • files: 1.4.4
  • files_external: 0.5.2
  • files_sharing: 0.9.1
  • files_texteditor: 2.1

So now i'll try to find which app is the needle in the haystack

@davitol
Contributor
davitol commented Mar 31, 2016

@rullzer It seems that activating workflow: 0.1.3 app is when the issue happens.

@rullzer
Contributor
rullzer commented Mar 31, 2016

Calling on @nickvergessen!

@nickvergessen
Contributor

Any tagging rules active?

@davitol
Contributor
davitol commented Apr 1, 2016

@nickvergessen No tagging rules active.

@PVince81
Collaborator
PVince81 commented Apr 1, 2016

@nickvergessen I get you didn't manage to reproduce it yet ?

@davitol
Contributor
davitol commented Apr 1, 2016
{"reqId":"9IrtS2ViiTo0s5rS5+Mo","remoteAddr":"82.159.139.58","app":"PHP","message":"Undefined index: printcssfiles at \/opt\/owncloud\/core\/templates\/layout.guest.php#21","level":3,"time":"2016-04-01T07:57:19+00:00","method":"GET","url":"\/index.php\/apps\/files\/","user":"user2"}
{"reqId":"9IrtS2ViiTo0s5rS5+Mo","remoteAddr":"82.159.139.58","app":"PHP","message":"Invalid argument supplied for foreach() at \/opt\/owncloud\/core\/templates\/layout.guest.php#21","level":3,"time":"2016-04-01T07:57:19+00:00","method":"GET","url":"\/index.php\/apps\/files\/","user":"user2"}

This log is generated when trying to access to the user2 account after the error

@nickvergessen
Contributor
@davitol
Contributor
davitol commented Apr 1, 2016

#23719

printcssfiles PR went fine, but it is not related to the original issue of files:transfer-ownership

@nickvergessen
Contributor

Okay I got the error once, but now I fail to reproduce it

@nickvergessen
Contributor

Exception:

{
    "reqId": "pcydF23B//0/e1cZrMss",
    "remoteAddr": "",
    "app": "no app in context",
    "message": {
        "Exception": {
            "Exception": "OCP\Files\NotFoundException",
            "Message": "File with id \"21\" has not been found.",
            "Code": 0,
            "Trace": {
                "#0": [
                    "/opt/owncloud/apps/files_sharing/lib/sharedstorage.php(90):",
                    "OC\Files\View->getPath(21)"
                ],
                "#1": [
                    "/opt/owncloud/apps/files_sharing/lib/sharedstorage.php(581):",
                    "OC\Files\Storage\Shared->init()"
                ],
                "#2": [
                    "/opt/owncloud/lib/private/files/storage/wrapper/wrapper.php(381): OC\Files\Storage\Shared->getCache('', Object(OCA\Workflow\AutoTagging\StorageWrapper))",
                    null
                ],
                "#3": [
                    "/opt/owncloud/apps/workflow/autotagging/storagewrapper.php(389): OC\Files\Storage\Wrapper\Wrapper->getCache('', Object(OCA\Workflow\AutoTagging\StorageWrapper))",
                    null
                ],
                "#4": [
                    "/opt/owncloud/lib/private/files/view.php(1306):",
                    "OCA\Workflow\AutoTagging\StorageWrapper->getCache('')"
                ],
                "#5": [
                    "/opt/owncloud/lib/private/files/node/root.php(179):",
                    "OC\Files\View->getFileInfo('/user2')"
                ],
                "#6": [
                    "/opt/owncloud/lib/private/files/node/root.php(341):",
                    "OC\Files\Node\Root->get('/user2')"
                ],
                "#7": [
                    "/opt/owncloud/lib/private/share20/share.php(127):",
                    "OC\Files\Node\Root->getUserFolder('user2')"
                ],
                "#8": [
                    "/opt/owncloud/lib/private/share20/manager.php(193):",
                    "OC\Share20\Share->getNode()"
                ],
                "#9": [
                    "/opt/owncloud/lib/private/share20/manager.php(652):",
                    "OC\Share20\Manager->generalCreateChecks(Object(OC\Share20\Share))"
                ],
                "#10": [
                    "/opt/owncloud/apps/files/command/transferownership.php(218):",
                    "OC\Share20\Manager->updateShare(Object(OC\Share20\Share))"
                ],
                "#11": [
                    "/opt/owncloud/apps/files/command/transferownership.php(114):",
                    "OCA\Files\Command\TransferOwnership->restoreShares(Object(Symfony\Component\Console\Output\ConsoleOutput))"
                ],
                "#12": [
                    "/opt/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\TransferOwnership->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))",
                    null
                ],
                "#13": [
                    "/opt/owncloud/3rdparty/symfony/console/Application.php(840): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))",
                    null
                ],
                "#14": [
                    "/opt/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\TransferOwnership), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))",
                    null
                ],
                "#15": [
                    "/opt/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))",
                    null
                ],
                "#16": [
                    "/opt/owncloud/lib/private/console/application.php(145): Symfony\Component\Console\Application->run(NULL, NULL)",
                    null
                ],
                "#17": [
                    "/opt/owncloud/console.php(88):",
                    "OC\Console\Application->run()"
                ],
                "#18": [
                    "/opt/owncloud/occ(11):",
                    "require_once('/opt/owncloud/c...')"
                ],
                "#19": [
                    "{main}",
                    null
                ]
            },
            "File": "/opt/owncloud/lib/private/files/view.php",
            "Line": 1643
        }
    },
    "level": 3,
    "time": "2016-04-01T09:08:44+00:00",
    "method": "--",
    "url": "--",
    "user": "--"
}
@PVince81
Collaborator
PVince81 commented Apr 1, 2016

Any insights to move this forward ?

@davitol did you find more precise steps to reproduce this ?

@davitol
Contributor
davitol commented Apr 1, 2016

I`ve already shared my server configuration with @nickvergessen and he was able to reproduce it with the steps defined in the original post.

@PVince81
Collaborator
PVince81 commented Apr 1, 2016

I'm also able to reproduce it several times on 9.0.1RC1 enterprise.
Does it also happen if you close the browser window before doing the transfer ? Because the browser window might still use that user's session and mess up somehow...

@PVince81
Collaborator
PVince81 commented Apr 1, 2016

Tried closing the browser window, doesn't fix the issue.

@davitol
Contributor
davitol commented Apr 1, 2016

Yes, it happens even if you close the browser, using several browser, etc

@PVince81
Collaborator
PVince81 commented Apr 1, 2016

I tried disabling the workflow app and the problem indeed disappears.

Maybe the workflow app registers some hooks that somehow interfere with the process ?

@davitol
Contributor
davitol commented Apr 1, 2016

@rullzer It seems that activating workflow: 0.1.3 app is when the issue happens.

yes, i tested disabling all apps and enabling them 1 by 1 and the origin of the problem seems to be only with the workflow app

@PVince81
Collaborator
PVince81 commented Apr 1, 2016

I see it's registering a storage wrapper, it is likely that the transfer ownership code is going through that.

@nickvergessen
Contributor

The problem is, that we do not unmount the shares before deleting them. So when later anything checks a storage we still have the invalid mount in the list.

I have the patch locally now and it works. Will push once I'm at home

@schiessle schiessle closed this in #23743 Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment