500 error on some articles after upgrade to ojs3

Dear all,

few months ago we upgrade from ojs2.3.7 to ojs 3.

Many article published from various journals are ok but now we have found that some published articles are not accessible. When you click on article title from a published issue a 500 error was found.

Reviewing log messsage we found this error for some articles

PHP Fatal error: Uncaught Error: Call to undefined method Article::getGalleys() in /ojs/pages/article/ArticleHandler.inc.php:102\nStack trace:\n#0 /ojs/lib/pkp/classes/core/PKPRouter.inc.php(390): ArticleHandler->view(Array, Object(Request))\n#1 /ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(232): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#2 /ojs/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPPageRouter->route(Object(Request))\n#3 ojs/lib/pkp/classes/core/PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))\n#4 /ojs/index.php(68): PKPApplication->execute()\n#5 {main}\n thrown in /ojs/pages/article/ArticleHandler.inc.php on line 102

As an editor I can access to this submission and view pdf galley from production tab.

Some other articles shows an error about can’t issue->getYear() but we access to this article clicking on this issue.

Any idea whats happening?

The error appearing in other articles

Uncaught Error: Call to a member function getYear() on null in /ojs/plugins/generic/googleScholar/GoogleScholarPlugin.inc.php:118\nStack trace:\n#0 /ojs/lib/pkp/classes/plugins/HookRegistry.inc.php(107): GoogleScholarPlugin->articleView(‘ArticleHandler:…’, Array)\n#1 /ojs/pages/article/ArticleHandler.inc.php(196): HookRegistry::call(‘ArticleHandler:…’, Array)\n#2 /ojs/lib/pkp/classes/core/PKPRouter.inc.php(390): ArticleHandler->view(Array, Object(Request))\n#3 /ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(232): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#4 /ojs/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPPageRouter->route(Object(Request))\n#5 /ojs/lib/pkp/classes/core/PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))\n#6 /projectes/raco-pro-new/ojs/index.php(68): PKPApplication->execute()\n# in /ojs/plugins/generic/googleScholar/GoogleScholarPlugin.inc.php on line 118, referer: https://myojs.com/index.php/myjournals/issue/view/2378

I’ve found the problem It’s related to cache

on ArticleHandler.inc.php initialize funtion get publishedArticles and issues calling getPublishedArticleByBestArticleId and getById.

    function initialize($request, $args) {
            $articleId = isset($args[0]) ? $args[0] : 0;

            $journal = $request->getContext();
            $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
            $publishedArticle = $publishedArticleDao->getPublishedArticleByBestArticleId((int) $journal->getId(), $articleId, **true**);

            $issueDao = DAORegistry::getDAO('IssueDAO');
            if (isset($publishedArticle)) {
                    $issue = $issueDao->getById($publishedArticle->getIssueId(), $publishedArticle->getJournalId(), **true**);
                    $this->issue = $issue;
                    $this->article = $publishedArticle;
            } else {
                    $articleDao = DAORegistry::getDAO('ArticleDAO');
                    $article = $articleDao->getById((int) $articleId, $journal->getId(), true);
                    $this->article = $article;
            }

            if (!isset($this->article)) $request->getDispatcher()->handle404();

            if (in_array($request->getRequestedOp(), array('view', 'download'))) {
                    $galleyId = isset($args[1]) ? $args[1] : 0;
                    $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
                    $this->galley = $galleyDao->getByBestGalleyId($galleyId, $this->article->getId());
                    if ($galleyId && !$this->galley) $request->getDispatcher()->handle404();
            }
    }

If I change ther third param (cache) from true to false it works and I can view articles from issue page.
I tried to clear cache as site admin but cache is “still alive”.

How cache works? How can I clear this cache?

Best regards,

Hi @pir,

Have you turned on the object_cache or memcache options in config.inc.php? If so, I’d suggest disabling them.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

Our config file is not using object_cache

;;;;;;;;;;;;;;;;;;
; Cache Settings ;
;;;;;;;;;;;;;;;;;;

[cache]

; Choose the type of object data caching to use. Options are:
; - memcache: Use the memcache server configured below
; - xcache: Use the xcache variable store
; - apc: Use the APC variable store
; - none: Use no caching.
object_cache = none

; Enable memcache support
memcache_hostname = localhost
memcache_port = 11211

; For site visitors who are not logged in, many pages are often entirely
; static (e.g. About, the home page, etc). If the option below is enabled,
; these pages will be cached in local flat files for the number of hours
; specified in the web_cache_hours option. This will cut down on server
; overhead for many requests, but should be used with caution because:
; 1) Things like journal metadata changes will not be reflected in cached
; data until the cache expires or is cleared, and
; 2) This caching WILL NOT RESPECT DOMAIN-BASED SUBSCRIPTIONS.
; However, for situations like hosting high-volume open access journals, it’s
; an easy way of decreasing server load.
;
; When using web_cache, configure a tool to periodically clear out cache files
; such as CRON. For example, configure it to run the following command:
; find …/ojs/cache -maxdepth 1 -name wc-*.html -mtime +1 -exec rm “{}” “;”
web_cache = Off
web_cache_hours = 1

Regards,

Hi @pir,

Memcache appears to be enabled – please disable it!

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

object_cache is set to none.

memcache_hostname and memcache_port o ly works if i set objet_cache as memcache, not?
Any way i comment this two params but it woks the same way.

The question is how to clear the chache used by issues and articles and regenerate ik to be like current information.

Regards

Hi,
we review configuration file and has no cache defined.
We have deleted cache files in cache dir and OJS admin has clear data and template cache. After this we try to access to some articles and a 500 error appers.

If i change cache parameter on initialize funtion in ArticleHandler.inc.php to get publishedArticles and issues calling getPublishedArticleByBestArticleId and getById the article is showed.

I’m not sure how cache is working because cleanin the cache it doen’t work but if i force in article template not to use cache we can access to articles.

regards,

Hi @pir,

Have you been using numeric public identifiers for articles? If so, then it’s possible that those are conflicting with OJS’s built-in identifiers. Change your public identifiers so that they can’t collide with OJS’s identifiers by adding something non-numeric to them.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

no, this articles has no public identifier. They are using article id provided from our ojs when it were created.

Regards

Hi @pir,

I’m afraid I’m having a hard time determining what’s happening by looking at the code. I’d suggest digging deeper into the PublishedArticleDAO to find out what SQL queries it’s using to look up the articles you’re viewing. With object_cache etc. disabled, there should actually be no caching present, so resetting the file cache etc. shouldn’t have any effect.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi all,

There is another report here:
https://github.com/pkp/pkp-lib/issues/5247

Unfortunately I haven’t been able to replicate the problem myself, so if anyone is able to dig a bit deeper in the code to provide more information, I’d be very interested.

Thanks,
Alec Smecher
Public Knowledge Project Team