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

Access to undeclared static property: OC\Files\Filesystem::$normalizedPathCache #22370

Closed
LukasReschke opened this issue Feb 13, 2016 · 141 comments
Closed

Comments

@LukasReschke
Copy link
Member

Seems to be caused by

$unlockLater = false;
if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
$unlockLater = true;
$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
if (in_array('write', $hooks)) {
$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
} else if (in_array('read', $hooks)) {
$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
}
});
}

{"reqId":"YZdjFpzB5CoaRlMO0bak","remoteAddr":"xxxx","app":"PHP","message":"Uncaught Error: Access to undeclared static property: OC\Files\Filesystem::$normalizedPathCache in lib/private/files/filesystem.php:799
Stack trace:
#0 lib/private/files/view.php(1919): OC\Files\Filesystem::normalizePath('/USER/files/shared...')
#1 lib/private/files/view.php(1055): OC\Files\View->unlockFile('/Shared/ownclou...', 1)
#2 [internal function]: OC\Files\View->OC\Files\{closure}()
#3 apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(106): call_user_func(Object(Closure))
#4 [internal function]: Icewind\Streams\CallbackWrapper->stream_close()
#5 {main}
  thrown at lib/private/files/filesystem.php#799","level":3,"time":"2016-02-12T14:02:57+00:00","method":"PROPFIND","url":"/owncloud/remote.php/webdav/"}

cc @icewind1991

@LukasReschke LukasReschke added this to the 9.0-current milestone Feb 13, 2016
@icewind1991
Copy link
Contributor

Any steps to reproduce?

Looks like the close callback is called during process teardown

@PVince81
Copy link
Contributor

@LukasReschke any info ?

@LukasReschke
Copy link
Member Author

No idea. It just regularly appears on the S3 error logs 🙈

@LukasReschke LukasReschke removed this from the 9.0-current milestone Feb 23, 2016
@LukasReschke LukasReschke removed their assignment Feb 23, 2016
@PVince81
Copy link
Contributor

PVince81 commented Mar 1, 2016

@dragotin thought it could be related to timeout issues.

@icewind1991 if there is a timeout, would the PHP tear down still called ? (that was on S3)

@LukasReschke LukasReschke added this to the backlog milestone Mar 1, 2016
@PVince81 PVince81 modified the milestones: 9.0.1-next-maintenance, backlog Mar 1, 2016
@PVince81
Copy link
Contributor

PVince81 commented Mar 1, 2016

Let's have a look at this as part of 9.0.1.

Would be good to have some logs. Sometimes cross-referencing the request id might help find out what else happened there. Maybe the audit log could help too.

@PVince81
Copy link
Contributor

PVince81 commented Mar 1, 2016

I also remember that sometimes in the tear down routine, PHP starts unloading static variables so it is not guaranteed that they are still available within the tear down / destructors...

@PVince81
Copy link
Contributor

PVince81 commented Mar 9, 2016

@LukasReschke is this still happening in the S3 logs ?

@PVince81
Copy link
Contributor

PVince81 commented Mar 9, 2016

(well, after the update to 9.0.0...)

@LukasReschke
Copy link
Member Author

Can't quite tell. It's still on 8.2.2, apparently 9.0 is aimed for this weekend

@PVince81
Copy link
Contributor

Looked at the code in the View: https://github.com/owncloud/core/blob/v8.2.3/lib/private/files/view.php#L1053 which calls unlock which itself uses the normalization function: https://github.com/owncloud/core/blob/v8.2.3/lib/private/files/view.php#L1920

The CallbackWrapper, IIRC, is called when the file gets closed.
There might be code paths and PHP versions in which the fclose is happening very late, at GC time.

If it's at GC time, it is likely that the GC has already destroyed that normalizedPathCache property from the static class. I saw this happen before.

The difficult part here is to find out which fclose call is missing, could be from an app.

@PVince81
Copy link
Contributor

Also, this is PHP 7, right ?

@Aidenir
Copy link

Aidenir commented Apr 4, 2016

I've seen the same issue (I'm pretty sure its the same) on my Arch server, which was recently updated to php 7.
Client: 2.1.1
Server: 8.2.1

@ghost ghost modified the milestones: 9.1-current, 9.0.1 Apr 11, 2016
@ToeiRei
Copy link

ToeiRei commented Apr 18, 2016

Same here with
PHP: 7 (also troubles with the same files with 5.6)
Client 2.1.1
Server 9.0.1

I even kicked out ACPu for testing - same result but still doing some tests to nail it down.

@PVince81
Copy link
Contributor

Hmm, and maybe PHP 7's GC logic is different so it could confirm that this is PHP 7 specific.

@ToeiRei
Copy link

ToeiRei commented Apr 18, 2016

@PVince81 So far I get a different error message on sync using PHP 5.6 - It's the same files that I cannot sync.

@PVince81
Copy link
Contributor

cannot sync

The original issue was not about sync issues, just a mysterious warning.
Can you provide more information ? It isn't clear yet whether that message is directly related to sync issues.

@PVince81 PVince81 reopened this Jan 19, 2017
@PVince81
Copy link
Contributor

All backports done, closing

@hdering
Copy link

hdering commented Feb 10, 2017

Should this error be fixed with OC 9.1.4?

Yesterday, I updated my instance to 9.1.4 but I already have the error:

[Fri Feb 10 08:24:39.863243 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: PHP message: PHP Fatal error:  Uncaught Error: Access to undeclared static property: OC\\Files\\Filesystem::$normalizedPathCache in /var/www/clients/client2/web46/web/lib/private/Files/Filesystem.php:793
[Fri Feb 10 08:24:39.863494 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: Stack trace:
[Fri Feb 10 08:24:39.863546 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #0 /var/www/clients/client2/web46/web/lib/private/Files/View.php(2041): OC\\Files\\Filesystem::normalizePath('/EFG-KL/files/L...')
[Fri Feb 10 08:24:39.863818 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #1 /var/www/clients/client2/web46/web/lib/private/Files/View.php(1153): OC\\Files\\View->unlockFile('/Lieder PPT/Son...', 1)
[Fri Feb 10 08:24:39.863867 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #2 [internal function]: OC\\Files\\View->OC\\Files\\{closure}()
[Fri Feb 10 08:24:39.863986 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #3 /var/www/clients/client2/web46/web/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure))
[Fri Feb 10 08:24:39.864076 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #4 [internal function]: Icewind\\Streams\\CallbackWrapper->stream_close()
[Fri Feb 10 08:24:39.864167 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr: #5 {main}
[Fri Feb 10 08:24:39.864310 2017] [:error] [pid 24183] [client 109.75.208.254:20098] FastCGI: server "/var/www/clients/client2/web46/cgi-bin/php5-fcgi-*-443-my.domain" stderr:   thrown in /var/www/clients/client2/web46/web/lib/private/Files/Filesystem.php on line 793

Apache2: 2.4.18
PHP: 7.0.13-0ubuntu0.16.04.1

I already tried to cleanup filecache and so on:
php occ files:cleanup
php occ maintenance:mimetype:update-db

@PVince81
Copy link
Contributor

@hdering all known code paths that cause such log messages have been fixed in 9.1.4, yes.

Maybe you found yet another code path causing this 😞

@PVince81
Copy link
Contributor

@hdering are you able to find out when this is happening ?

In the known cases it used to happen for aborted uploads or downloads. (download a file with the web browser but cancel it)

@hdering
Copy link

hdering commented Feb 10, 2017

It happens when I try to open it through Browser, a simple click on the file.

And it happens through die Desktop Client. I get the message: "Operation abgebrochen".

@PVince81
Copy link
Contributor

and does the file open correctly or is it corrupt ?

It could also be a problem in your environment that prevents downloads to work correctly and only shows this message as a side effect.

@hdering
Copy link

hdering commented Feb 10, 2017

No the file doesn't open correctly.

image

@PVince81
Copy link
Contributor

@hdering I suggest you investigate your environment. The error you see is just a side effect of something else preventing the download to start/finish.

Maybe try retrieving that URL with curl and see whether you get 0 bytes or more.
If 0 bytes, then something is likely wrong in your environment and something is blocking the download. (could be a php-fpm config issue of some sorts)

@hdering
Copy link

hdering commented Feb 10, 2017

it does not affect all files, only a few files.

@PVince81
Copy link
Contributor

if you have encryption enabled, check in oc_filecache whether that specific file has the "encrypted" flag set to 1. If not, set it manually and try downloading it twice.

@hdering
Copy link

hdering commented Feb 10, 2017

For test i switched to fastcgi. the same:

[fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Access to undeclared static property: OC\\Files\\Filesystem::$normalizedPathCache in /var/www/clients/client2/web46/web/lib/private/Files/Filesystem.php:793
[Fri Feb 10 09:50:22.244693 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: Stack trace:
[Fri Feb 10 09:50:22.244702 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #0 /var/www/clients/client2/web46/web/lib/private/Files/View.php(2041): OC\\Files\\Filesystem::normalizePath('/EFG-KL/files/L...')
[Fri Feb 10 09:50:22.244707 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #1 /var/www/clients/client2/web46/web/lib/private/Files/View.php(1153): OC\\Files\\View->unlockFile('/Lieder PPT/Son...', 1)
[Fri Feb 10 09:50:22.244712 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #2 [internal function]: OC\\Files\\View->OC\\Files\\{closure}()
[Fri Feb 10 09:50:22.244736 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #3 /var/www/clients/client2/web46/web/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure))
[Fri Feb 10 09:50:22.244801 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #4 [internal function]: Icewind\\Streams\\CallbackWrapper->stream_close()
[Fri Feb 10 09:50:22.244807 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr: #5 {main}
[Fri Feb 10 09:50:22.244811 2017] [fcgid:warn] [pid 29469] [client 109.75.208.254:24798] mod_fcgid: stderr:   thrown in /var/www/clients/client2/web46/web/lib/private/Files/Filesystem.php on line 793

@hdering
Copy link

hdering commented Feb 10, 2017

Do you mean oc_filecache in database?

@hdering
Copy link

hdering commented Feb 10, 2017

@PVince81 Now I checked oc_filecache. For me it is just the other way. The original version has encrypted = 1. The other versions have 0. But it doesn't help to change from 1 to 0 or 0 to 1.

@hdering
Copy link

hdering commented May 16, 2017

@PVince81 Unfortunately, this behavior occurs with another user. Other installation, but same server.

I checked the oc_filecache entry and the encrypted was 0. I changed it to 1 but it does not help.

owncloud Version is 9.1.4.

Do you have any idea?

@PVince81
Copy link
Contributor

@hdering without detailed logs it will be impossible to guess and help

@hdering
Copy link

hdering commented May 16, 2017

@PVince81 If I try to download a file from Browser I get the mesage ERR_INVALID_RESPONSE.

image

If I try to download through the Android App I get a 500 error.

owncloud.log:
{"reqId":"nKtJuZkzNoXtverTkR4T","remoteAddr":"x.x.x.x","app":"webdav","message":"Exception: {\"Message\":\"Bad Signature\",\"Exception\":\"OC\\\\HintException\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/apps\\\/encryption\\\/lib\\\/Crypto\\\/Crypt.php(463): OCA\\\\Encryption\\\\Crypto\\\\Crypt->checkSignature('McpPP0a1KClI\\\/WG...', 'y8z\\\\xB8\\\\xB7\\\\xD7\\\\xF1\\\\xE0Sx\\\\xC9L\\\\xEB\\\\x1A\\\\x9F...', '7507f57bb5d918b...')\\n#1 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/apps\\\/encryption\\\/lib\\\/Crypto\\\/Encryption.php(363): OCA\\\\Encryption\\\\Crypto\\\\Crypt->symmetricDecryptFileContent('McpPP0a1KClI\\\/WG...', 'y8z\\\\xB8\\\\xB7\\\\xD7\\\\xF1\\\\xE0Sx\\\\xC9L\\\\xEB\\\\x1A\\\\x9F...', 'AES-256-CTR', 1, 0)\\n#2 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/lib\\\/private\\\/Files\\\/Stream\\\/Encryption.php(459): OCA\\\\Encryption\\\\Crypto\\\\Encryption->decrypt('McpPP0a1KClI\\\/WG...', 0)\\n#3 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/lib\\\/private\\\/Files\\\/Stream\\\/Encryption.php(290): OC\\\\Files\\\\Stream\\\\Encryption->readCache()\\n#4 [internal function]: OC\\\\Files\\\\Stream\\\\Encryption->stream_read(8192)\\n#5 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/3rdparty\\\/sabre\\\/http\\\/lib\\\/Sapi.php(78): stream_copy_to_stream(Resource id #84, Resource id #86, '22248')\\n#6 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(470): Sabre\\\\HTTP\\\\Sapi::sendResponse(Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#8 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(57): Sabre\\\\DAV\\\\Server->exec()\\n#9 \\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/remote.php(164): require_once('\\\/var\\\/www\\\/client...')\\n#10 {main}\",\"File\":\"\\\/var\\\/www\\\/clients\\\/client2\\\/web46\\\/web\\\/apps\\\/encryption\\\/lib\\\/Crypto\\\/Crypt.php\",\"Line\":483,\"User\":\"Ernst\"}","level":4,"time":"2017-05-16T11:29:08+00:00","method":"GET","url":"\/remote.php\/webdav\/Ernst\/HolzinTakt-Cajon\/Fahrtenbuch.xlsx","user":"Ernst"}

@PVince81
Copy link
Contributor

@hdering this looks unrelated to "normalizedPathCache" error. Looks more like #27824 (comment)

@hdering
Copy link

hdering commented May 16, 2017

@PVince81 this are bad news...

@lenusch
Copy link

lenusch commented Aug 17, 2017

is there no fix? This cant be true

@PVince81
Copy link
Contributor

@lenusch the fix was already released and works, please upgrade.

If you still see it, please make a new ticket and use the issue template https://raw.githubusercontent.com/owncloud/core/master/.github/issue_template.md

@lenusch
Copy link

lenusch commented Aug 17, 2017

@PVince81 i have latest nextcloud. Still same Errors.

@ghost
Copy link

ghost commented Aug 18, 2017

@lenusch Just a note that ownCloud is not Nextcloud, and you're currently in the ownCloud bugtracker. If something like this is happening in Nextcloud it doesn't mean if applies for ownCloud as well.

@lenusch
Copy link

lenusch commented Aug 18, 2017

@kdslkdsaldsal yes i have noticed too. Sorry.
Also posted into Nextcloud, can be deleted on owncloud if you want to.
Or can i delete by my self?

@lock
Copy link

lock bot commented Aug 2, 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 Aug 2, 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