diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-10-18 17:35:39 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-10-18 17:35:39 +0200 |
commit | b76b5f942407212a980d8707f27399fdbc081092 (patch) | |
tree | 588f00e332806942c03718ca4a20211801e8e2b9 | |
parent | 69070bf617a976124c338236cbdbacb2a2645e20 (diff) | |
download | nextcloud-server-debug/snae.tar.gz nextcloud-server-debug/snae.zip |
debug: collect message on a SessionNotAvailableException casedebug/snae
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | lib/base.php | 2 | ||||
-rw-r--r-- | lib/private/App/AppManager.php | 8 | ||||
-rw-r--r-- | lib/private/legacy/OC_User.php | 9 |
3 files changed, 18 insertions, 1 deletions
diff --git a/lib/base.php b/lib/base.php index 115e7b11daf..980e486b54e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -447,6 +447,8 @@ class OC { $cryptoWrapper = Server::get(\OC\Session\CryptoWrapper::class); $session = $cryptoWrapper->wrapSession($session); + $e = new \Exception('Stacktrace for initializing Internal/Encrypted session'); + \OCP\Log\logger('core')->warning('SnaeDebug: Updating UserSession with persistent Internal/Encrypted backend', [ 'exception' => $e ]); self::$server->setSession($session); // if session can't be started break with http 500 error diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 60e55a314d6..e182314c50d 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -42,6 +42,7 @@ use InvalidArgumentException; use OC\AppConfig; use OC\AppFramework\Bootstrap\Coordinator; use OC\ServerNotAvailableException; +use OC\Session\CryptoSessionData; use OCP\Activity\IManager as IActivityManager; use OCP\App\AppPathNotFoundException; use OCP\App\Events\AppDisableEvent; @@ -210,6 +211,13 @@ class AppManager implements IAppManager { foreach ($apps as $app) { if (!$this->isAppLoaded($app) && ($types === [] || $this->isType($app, $types))) { try { + if (in_array('session', $types, true)) { + $e = new \Exception('Stacktrace for loading session-type app'); + \OCP\Log\logger('core')->warning('SnaeDebug: Loading session app ' . $app, [ 'exception' => $e ]); + } else if (method_exists($this->userSession, 'getSession') && !$this->userSession->getSession() instanceof CryptoSessionData) { + $e = new \Exception('Stacktrace for early loading of non session-type app'); + \OCP\Log\logger('core')->warning('SnaeDebug: Loading app early: ' . $app, [ 'exception' => $e, 'session' => get_class($this->userSession->getSession()) ]); + } $this->loadApp($app); } catch (\Throwable $e) { $this->logger->emergency('Error during app loading: ' . $e->getMessage(), [ diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index 9fd4e502fb4..dbb2cec6138 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -210,9 +210,14 @@ class OC_User { 'filesystem' => true, ]); $tokenProvider->updateToken($token); - } catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException) { + } catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException $e) { // swallow the exceptions as we do not deal with them here // simply skip updating the token when is it missing + \OCP\Log\logger('core')->warning('SnaeDebug: Potential error case', [ + 'uid' => $uid, + 'session_class' => get_class($userSession->getSession()), + 'exception' => $e, + ]); } } @@ -255,6 +260,8 @@ class OC_User { * null: not handled / no backend available */ public static function handleApacheAuth() { + $e = new \Exception('Stacktrace for invoking apache auth'); + \OCP\Log\logger('core')->warning('SnaeDebug: ApacheAuth was invoked', [ 'exception' => $e ]); $backend = self::findFirstActiveUsedBackend(); if ($backend) { OC_App::loadApps(); |