[OJS 3.2.1.4] Error in Scheduled Tasks an not show metrics

Hi,

I have had an error for almost a month since the Usage Stats are not shown and remain in the stage phase.

image

I have the Acron plugin enabled and also when I try to run php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml, after a while, it shows me the following error:

PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /lib/pkp/classes/submission/Representation.inc.php:134
Stack trace:
#0 /lib/pkp/classes/statistics/PKPMetricsDAO.inc.php(378): Representation->getContextId()
#1 /classes/statistics/MetricsDAO.inc.php(47): PKPMetricsDAO->foreignKeyLookup(515, 246408)
#2 /lib/pkp/classes/statistics/PKPMetricsDAO.inc.php(284): MetricsDAO->foreignKeyLookup(515, 246408)
#3 /plugins/generic/usageStats/UsageStatsLoader.inc.php(823): PKPMetricsDAO->insertRecord(Array)
#4 /plugins/generic/usageStats/UsageStatsLoader.inc.php(228): UsageStatsLoader->_loadData('usage_events_20...')
#5 /lib/pkp/classes/task/FileLoader.inc.php(167): UsageStatsLoader->processFile('/datos/usageSta...')
#6 /lib/pkp/classes/submission/Representation.inc.php on line 134

And also shows me:

Undefined offset: 254 in /plugins/generic/usageStats/lib/geoIp/geoipcity.inc on line 146

Hi @asmecher and @bozana,

Could you help me with this problem?

Hi @rcgillis,

Can someone help me with this problem?

Hi @diegomejia07,

This comes from a data inconsistency in your database; you have a galley that is referring to a non-existent publication. Try this query to identify it:

SELECT pg.galley_id FROM publication_galleys pg LEFT JOIN publications p ON (pg.publication_id = p.publication_id) WHERE pg.publication_id IS NOT NULL AND pg.publication_id IS NULL;

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Perform the query and I do not get records

image

Hi @diegomejia07,

Hmm, that was my best guess.

Essentially you have a database inconsistency related to the submission file with ID 246408. I would suggest exploring that entry in submission_files to see whether it is missing a related entity – for example, the submission it’s associated with has been deleted, or something like that.

Note that OJS 3.2.1-4 is quite old; I would recommend upgrading. It might resolve this problem. We’re trying not to put much support effort into old releases as it leads to re-identifying old bugs and isn’t an efficient use of our time! We recently launched an LTS initiative to help resolve this – see:

https://pkp.sfu.ca/2022/02/15/pkp-announces-long-term-support-lts-software-releases/

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

There checking the submission_files table for this ID, it shows me:

image

Hi @asmecher,

Is there anything else I can do there to fix this problem, since we don’t have an update scheduled for the next few months.

Hi @diegomejia07,

I’d recommend reviewing that entry’s foreign keys to ensure that they refer to existing objects. (And in turn, the foreign keys referenced from those entries).

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

What version do you recommend me to go to 3.3 of OJS.

Hi @diegomejia07,

The newest is best.

Regards,
Alec Smecher
Public Knowledge Project Team