From 3395f6081c7548a5064596215227562a1c9fab72 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 22 Jun 2017 14:37:32 +0200 Subject: [PATCH] Endless loop nesting on ensureHub failure now fixed Essentially I was missing a negation on a test if we were in rediscovery mode. --- plugins/OStatus/classes/FeedSub.php | 6 ++++-- plugins/OStatus/lib/pushinqueuehandler.php | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index c6f6e28cbd..c734da80b1 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -216,6 +216,7 @@ class FeedSub extends Managed_DataObject */ public function ensureHub($rediscovered=false) { + common_debug('Now inside ensureHub again, $rediscovered=='._ve($rediscovered)); if ($this->sub_state !== 'inactive') { common_log(LOG_INFO, sprintf(__METHOD__ . ': Running hub discovery a possibly active feed in %s state for URI %s', _ve($this->sub_state), _ve($this->uri))); } @@ -244,7 +245,7 @@ class FeedSub extends Managed_DataObject common_debug('Database update failed for FeedSub id=='._ve($this->id).' with new huburi: '._ve($this->huburi)); throw new ServerException('Database update failed for FeedSub.'); } - if ($rediscovered) { + if (!$rediscovered) { $this->renew(); } return $result; @@ -447,7 +448,8 @@ class FeedSub extends Managed_DataObject // we avoid running this part over and over and over and over): common_debug('Running ensureHub again due to 422 status, $rediscovered=='._ve($rediscovered)); - $this->ensureHub(true); + $discoveryResult = $this->ensureHub(true); + common_debug('ensureHub is now done and its result was: '._ve($discoveryResult)); } else { common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody()); } diff --git a/plugins/OStatus/lib/pushinqueuehandler.php b/plugins/OStatus/lib/pushinqueuehandler.php index c5615daad8..4946186cf4 100644 --- a/plugins/OStatus/lib/pushinqueuehandler.php +++ b/plugins/OStatus/lib/pushinqueuehandler.php @@ -45,7 +45,11 @@ class PushInQueueHandler extends QueueHandler } catch(NoResultException $e) { common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}"); } catch(Exception $e) { - common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . $e->getMessage()); + if (is_null($feedsub)) { + common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing where FeedSub->receive returned null!" . _ve($e->getMessage())); + } else { + common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . _ve($e->getMessage())); + } } return true; }