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

Error: Call to a member function getPath() on null in /lib/private/Files/Filesystem.php:878 #29674

Closed
Linuxfabrik opened this issue Nov 11, 2021 · 13 comments · Fixed by #31771
Closed
Labels
1. to develop Accepted and waiting to be taken care of bug

Comments

@Linuxfabrik
Copy link

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

Not known

Expected behaviour

Actual behaviour

On Cronjob /var/www/html/nextcloud/cron.php:

Error: Call to a member function getPath() on null in /var/www/html/nextcloud/lib/private/Files/Filesystem.php:878
Stack trace:
#0 /var/www/html/nextcloud/lib/private/Encryption/Update.php(107): OC\Files\Filesystem::getPath()
#1 /var/www/html/nextcloud/lib/private/Encryption/HookManager.php(40): OC\Encryption\Update->postUnshared()
#2 /var/www/html/nextcloud/lib/private/legacy/OC_Hook.php(106): OC\Encryption\HookManager::postUnshared()
#3 /var/www/html/nextcloud/lib/private/Share20/LegacyHooks.php(84): OC_Hook::emit()
#4 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\Share20\LegacyHooks->postUnshare()
#5 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
#6 /var/www/html/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#7 /var/www/html/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(123): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#8 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1202): OC\EventDispatcher\SymfonyAdapter->dispatch()
#9 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1510): OC\Share20\Manager->deleteShare()
#10 /var/www/html/nextcloud/lib/private/Share20/Manager.php(1411): OC\Share20\Manager->checkExpireDate()
#11 /var/www/html/nextcloud/apps/files_sharing/lib/ExpireSharesJob.php(97): OC\Share20\Manager->getShareById()
#12 /var/www/html/nextcloud/lib/public/BackgroundJob/Job.php(79): OCA\Files_Sharing\ExpireSharesJob->run()
#13 /var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php(63): OCP\BackgroundJob\Job->execute()
#14 /var/www/html/nextcloud/cron.php(127): OCP\BackgroundJob\TimedJob->execute()
#15 {main}

Server configuration

Operating system:
CentOS 7

Web server:
Apache 2.4.6

Database:
MariaDB-server-10.3.31-1

PHP version:
PHP 7.4.25
Zend Engine v3.4.0

Nextcloud version: (see Nextcloud admin page)
22.2.0

Updated from an older Nextcloud/ownCloud or fresh install:
Updated from Nextcloud 21

Where did you install Nextcloud from:
https://download.nextcloud.com/server/releases

Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

No errors have been found.

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Enabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - apporder: 0.13.0
  - bookmarks: 10.0.2
  - bruteforcesettings: 2.2.0
  - calendar: 2.3.4
  - checksum: 1.1.2
  - circles: 22.1.1
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - contacts: 4.0.6
  - contactsinteraction: 1.3.0
  - dashboard: 7.2.0
  - dav: 1.19.0
  - encryption: 2.10.0
  - external: 3.9.0
  - federatedfilesharing: 1.12.0
  - federation: 1.12.0
  - files: 1.17.0
  - files_external: 1.13.0
  - files_markdown: 2.3.4
  - files_pdfviewer: 2.3.0
  - files_rightclick: 1.1.0
  - files_sharing: 1.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - files_videoplayer: 1.11.0
  - firstrunwizard: 2.11.0
  - groupfolders: 10.0.0
  - impersonate: 1.9.0
  - logreader: 2.7.0
  - lookup_server_connector: 1.10.0
  - mail: 1.10.5
  - metadata: 0.14.0
  - nextcloud_announcements: 1.11.0
  - notifications: 2.10.1
  - oauth2: 1.10.0
  - password_policy: 1.12.0
  - photos: 1.4.0
  - privacy: 1.6.0
  - provisioning_api: 1.12.0
  - quota_warning: 1.11.0
  - recommendations: 1.1.0
  - richdocuments: 4.2.3
  - serverinfo: 1.12.0
  - settings: 1.4.0
  - sharebymail: 1.12.0
  - sharingpath: 0.4.3
  - support: 1.5.0
  - tasks: 0.14.2
  - text: 3.3.0
  - theming: 1.13.0
  - twofactor_backupcodes: 1.11.0
  - twofactor_totp: 6.1.0
  - twofactor_u2f: 6.2.0
  - unsplash: 1.2.3
  - updatenotification: 1.12.0
  - user_status: 1.2.0
  - viewer: 1.6.0
  - weather_status: 1.2.0
  - workflowengine: 2.4.0
Disabled:
  - admin_audit
  - notes
  - socialsharing_diaspora
  - socialsharing_facebook
  - socialsharing_twitter
  - survey_client
  - systemtags
  - user_ldap

Nextcloud configuration:

Config report
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "22.2.0.2",
        "overwrite.cli.url": "***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "overwritecondaddr": "***",
        "overwritehost": "***",
        "overwriteprotocol": "https",
        "overwritewebroot": "\/",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "filelocking.enabled": true,
        "log_rotate_size": 10485760,
        "loglevel": 3,
        "logtimezone": "Europe\/Zurich",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "dbindex": 0,
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0
        },
        "maintenance": false,
        "skeletondirectory": "\/var\/www\/html\/nextcloud\/core\/custom_skeleton",
        "theme": "",
        "app_install_overwrite": [
            "sharerenamer",
            "calendar"
        ],
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "default_phone_region": "CH"
    }
}

Insert your config.php content here. 
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

<?php
$CONFIG = array (
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '***',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.0.2',
  'overwrite.cli.url' => '***',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_nextcloud-adm',
  'dbpassword' => '***',
  'installed' => true,
  'instanceid' => '***,
  'overwritecondaddr' => '***',
  'overwritehost' => '***',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'trusted_proxies' =>
  array (
    0 => '***',
  ),
  'filelocking.enabled' => true,
  'log_rotate_size' => 10485760,
  'loglevel' => 3,
  'logtimezone' => 'Europe/Zurich',
  'mail_domain' => '***',
  'mail_from_address' => 'noreply',
  'mail_smtphost' => 'localhost',
  'mail_smtpmode' => 'smtp',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'dbindex' => 0,
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0,
  ),
  'maintenance' => false,
  'skeletondirectory' => '/var/www/html/nextcloud/core/custom_skeleton',
  'theme' => '',
  'app_install_overwrite' =>
  array (
    0 => 'sharerenamer',
    1 => 'calendar',
  ),
  'encryption.legacy_format_support' => false,
  'encryption.key_storage_migrated' => false,
  'default_phone_region' => 'CH',
);

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

@Linuxfabrik Linuxfabrik added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Nov 11, 2021
@solracsf solracsf changed the title Error: Call to a member function getPath() on null in /var/www/html/nextcloud/lib/private/Files/Filesystem.php:878 Error: Call to a member function getPath() on null in /lib/private/Files/Filesystem.php:878 Nov 12, 2021
@dedisupp
Copy link

dedisupp commented Jan 7, 2022

Have you any update on this case ?
We meet the same error

@dedisupp

This comment was marked as spam.

@dedisupp

This comment was marked as spam.

@dedisupp

This comment was marked as spam.

@PVince81
Copy link
Member

I'm guessing that we're missing a setupFS / teardownFS around that code.
The tricky part is figuring out for what user to set it up, the one from "uid_owner" perhaps ?

Usually cron jobs don't setup the FS for each user as it's slower, so it's only done on demand.
Here it seems the "on-demand" bit is missing.

@PVince81 PVince81 added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Feb 21, 2022
@PVince81
Copy link
Member

idea: in the background job:

  • add "uid_owner" to the SQL statements above
  • add setupFS / tearDown around the try/catch and pass the share owner to setupFS()

@PVince81
Copy link
Member

PVince81 commented Feb 21, 2022

  • maybe sort by uid_owner also to avoid setting up the same user repeatedly ? (beware whether an index exists for this)

@dedisupp
Copy link

dedisupp commented Mar 4, 2022

Hi,
Many thanks for your suggestion.
Can you send to me the good code to place or any explanation on the setupFS function ?
For example, I've found this code:
public static function getMountManager($user = '') {
if (!self::$mounts) {
\OC_Util::setupFS($user);
}
return self::$mounts;
}

Do you mean that I need to add some parameter on the line "\OC_Util::setupFS($user);" like "\OC_Util::setupFS($user,$uid_owner);" ?
But I can't finf any variable named uid_owner on the PHP file (Filesystem.php)...

How can I add a field in the SQL statement ?

Thanks

Regards,

@dedisupp
Copy link

dedisupp commented Mar 4, 2022

I don't know if this can help, but in the mean time, the Windows agent is unable to permit share management. When we right click on a file, then select Nextcloud | Share options, the window tries to open, but closes instantly...

@dedisupp
Copy link

dedisupp commented Mar 4, 2022

I've enabled log on MySQL during a share creation.

I see this strange behaviour (SQL queries):

It seems that hi first save the share:
INSERT INTO oc_activity (app, subject, subjectparams, message, messageparams, file, link, user, affecteduser, timestamp, priority, type, object_type, object_id) VALUES('files_sharing', 'shared_link_self', '[{"260805":"\/Desktop\/Analytics Stop.jpg"}]', '', '[]', '/Desktop/Analytics Stop.jpg', 'https://xxx.myserver.zzz/index.php/apps/files/?dir=/Desktop', 'user1', 'user1', '1646409691', '30', 'shared', 'files', '260805')

And a few seconds later, it seems that the share is marked as expired:
INSERT INTO oc_activity (app, subject, subjectparams, message, messageparams, file, link, user, affecteduser, timestamp, priority, type, object_type, object_id) VALUES('files_sharing', 'link_expired', '[{"260805":"\/Analytics Stop.jpg"}]', '', '[]', '/Analytics Stop.jpg', 'https://xxx.myserver.zzz/index.php/apps/files/?dir=/', '', 'user1', '1646409699', '30', 'shared', 'files', '260805')
SELECT * FROM oc_share WHERE (parent = '1312') AND (share_type IN (0, 1, 3)) AND ((item_type = 'file') OR (item_type = 'folder')) ORDER BY id ASC
DELETE FROM oc_share WHERE id = '1312'

I'm not sure that this is normal or not. Just I found this 2 queries very strange...

Thanks !

@dedisupp
Copy link

Hello,
We didn't receive any reply from you do you have any updates please?
We are getting stuck on this case, and it is causing a lot of troubles for us.
Thank you very much for your help.

CarlSchwan added a commit that referenced this issue Mar 31, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
Copy link
Member

I started working on this #31771 still wip

CarlSchwan added a commit that referenced this issue Mar 31, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue Mar 31, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue May 6, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue May 30, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
nextcloud-command pushed a commit that referenced this issue Jun 7, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue Jun 22, 2022
Make sure the setup fs is set before using the Update service

Fix #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue Jun 22, 2022
Make sure the setup fs is set before using the Update service

Backport of #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue Jul 6, 2022
Make sure the setup fs is set before using the Update service

Backport of #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this issue Jul 6, 2022
Make sure the setup fs is set before using the Update service

Backport of #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
backportbot-nextcloud bot pushed a commit that referenced this issue Jul 7, 2022
Make sure the setup fs is set before using the Update service

Backport of #29674

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@dedisupp
Copy link

Hello,

The last major update of Nextcloud is supposed to resolve this issue, but we are still facing it on some of our nextcloud hosts despite the update.
Can you please tell which fontion or database record should we verify ?

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants