Hello,
First, about my installation:
OJS: 2.4.8-5
PHP: 5.5.9
OS: Ubuntu 14.04.6 LTS x86_64
I’m seeing this bug constantly on my logs (and also this one that may be related):
[Tue Jul 09 19:26:18.702548 2019] [:error] [pid 2180] [client 159.224.221.175:41882] PHP Fatal error: Call to a member function getId() on a non-object in /var/www/ojs-2.4.8-5/pages/comment/CommentHandler.inc.php on line 185, referer: http://www.periodicos.ufpb.br/index.php/index/
The code:
> /**
* Validation * @param $request PKPRequest * @param $articleId int */ function validate(&$request, $articleId) { parent::validate(); $journal =& $request->getJournal(); $journalId = $journal->getId(); // UP THERE! ^^^^^^^^^^^^^^^^^ $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); // Bring in comment constants $commentDao =& DAORegistry::getDAO('CommentDAO'); $enableComments = $journal->getSetting('enableComments'); if ((!Validation::isLoggedIn() && $journalSettingsDao->getSetting($journalId,'restrictArticleAccess')) || ($article && !$article->getEnableComments()) || ($enableComments != COMMENTS_ANONYMOUS && $enableComments != COMMENTS_AUTHENTICATED && $enableComments != COMMENTS_UNAUTHENTICATED)) { Validation::redirectLogin(); } // Subscription Access $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueByArticleId($articleId); if (isset($issue) && isset($article)) { import('classes.issue.IssueAction'); $subscriptionRequired = IssueAction::subscriptionRequired($issue); $subscribedUser = IssueAction::subscribedUser($journal, $issue->getId(), $articleId); if (!(!$subscriptionRequired || $article->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser)) { $request->redirect(null, 'index'); } } else { $request->redirect(null, 'index'); } $this->issue =& $issue; $this->article =& $article; return true; }
OJS/Apache2 is using a lot of resources and will eventually become very slow (VM with 4 CPUs and 4GB of RAM), sometimes even crashing the VM as it uses all available RAM. PHP memory_limit is set at 1536M.
Before updating to 2.4.8-5 from 2.4.8-2, I tried to upgrade to 3.1.2-1. But a number of inconsistencies in the database prevented the upgrade. I restored a VM snapshot and the upgrade to 2.4.8-5 ran without flaws. Or so I believed.
I think those database inconsistencies (like this one) are the cause of this problem.