Cron job fails ReviewReminder after OJS 3.2.1 upgrade

Last week we upgraded our OJS multi-journal instance from OJS 3.1.2-4 to OJS 3.2.1-1. Since the upgrade our daily runScheduledTasks cron job has been reporting the following error:

PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/task/ReviewReminder.inc.php:156
Stack trace:
#0 /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/scheduledTask/ScheduledTask.inc.php(146): ReviewReminder->executeActions()
#1 /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/cliTool/ScheduledTaskTool.inc.php(110): ScheduledTask->execute()
#2 /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/cliTool/ScheduledTaskTool.inc.php(94): ScheduledTaskTool->executeTask('lib.pkp.classes...', Array)
#3 /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/cliTool/ScheduledTaskTool.inc.php(66): ScheduledTaskTool->parseTasks('registry/schedu...')
#4 /var/www/journals/ojs-3.2.1-1/tools/runScheduledTasks.php(34): ScheduledTaskTool->execute()
#5 {main}
 thrown in /var/www/journals/ojs-3.2.1-1/lib/pkp/classes/task/ReviewReminder.inc.php on line 156

Has anyone else run into this after upgrading?

Any chance it could be related to another issue we had ([OMP] Error upgrading from version 3.1.2-4 to 3.2.0 · Issue #5583 · pkp/pkp-lib · GitHub) where citation entries did not have corresponding submission entires?

Hi @andjsmit,

It looks like you have an entry in the submissions table where context_id doesn’t correspond to an existing journal_id in the journals table. You can check the following:

SELECT s.submission_id, s.context_id FROM submissions s LEFT JOIN journals j ON (s.context_id = j.journal_id) WHERE j.journal_id IS NULL;

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for the help. This query did return 48 rows. Is there a safe way to remove these or do I need to look further into what journal each submissions should be assigned to? Of the 48 rows, three context_id’s are returned.

Hi @andjsmit,

I’d suggest looking into those a little more before deleting them. Essentially it means there are submissions that don’t belong to any journals, which shouldn’t be the case. Were some journals deleted? The journal deletion process should remove all submissions, but maybe there was a problem there.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I have the same problem with ReviewReminder mails are not sent since upgrade from OJS 3.1.2.1 to OJS 3.3.0.8.

I also have a list of submissions without a journal. However, how do I remove those submissions? Tried with the deletesubmissions script but get the following error:

PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('1')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('1')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597

How do I do that in mysql, and is it safe to do it there!?

An update:
I saw the following thread:

Running that query gives a list of 12 rows.

MariaDB [ojs]> SELECT * FROM submission_files WHERE uploader_user_id NOT IN (SELECT DISTINCT user_id FROM users);
+--------------------+---------------------------+---------------+------------+----------+---------------------+---------------------+----------+----------+--------------------+------------+------------------+------------+---------+
| submission_file_id | source_submission_file_id | submission_id | file_stage | viewable | created_at          | updated_at          | assoc_id | genre_id | direct_sales_price | sales_type | uploader_user_id | assoc_type | file_id |
+--------------------+---------------------------+---------------+------------+----------+---------------------+---------------------+----------+----------+--------------------+------------+------------------+------------+---------+
|               1226 |                      NULL |           337 |          2 |        1 | 2018-03-08 11:57:26 | 2018-03-08 11:57:26 |     NULL |       85 | NULL               | NULL       |             2734 |       NULL |    1172 |
|               1227 |                      1226 |           337 |          4 |        1 | 2018-03-08 11:57:26 | 2018-03-08 12:12:06 |      268 |       85 | NULL               | NULL       |             2734 |        523 |    1173 |
|               1339 |                      NULL |           364 |          2 |        1 | 2018-04-13 08:49:32 | 2018-04-13 08:49:32 |     NULL |       85 | NULL               | NULL       |             2734 |       NULL |    1267 |
|               1617 |                      NULL |           433 |          2 |        1 | 2018-06-05 02:12:20 | 2018-06-05 02:12:20 |     NULL |       73 | NULL               | NULL       |              670 |       NULL |    1516 |
|               1618 |                      NULL |           433 |          2 |        1 | 2018-06-05 02:13:04 | 2018-06-05 02:13:04 |     NULL |       84 | NULL               | NULL       |              670 |       NULL |    1517 |
|               1827 |                      NULL |           532 |          2 |        1 | 2018-06-05 13:34:29 | 2018-06-05 13:34:29 |     NULL |       85 | NULL               | NULL       |             2734 |       NULL |    1576 |
|               1833 |                      NULL |           253 |         18 |        0 | 2018-06-07 10:57:01 | 2018-06-07 10:57:01 |      933 |       73 | NULL               | NULL       |              670 |        520 |    1582 |
|               2142 |                      1827 |           532 |          4 |        1 | 2018-06-05 13:34:29 | 2018-06-10 20:42:54 |      310 |       85 | NULL               | NULL       |             2734 |        523 |    1633 |
|               2282 |                      NULL |           253 |         15 |        0 | 2018-08-06 22:19:28 | 2018-08-06 22:19:28 |      201 |       73 | NULL               | NULL       |              670 |        523 |    1757 |
|               2508 |                      2282 |           253 |          6 |        1 | 2018-08-06 22:19:28 | 2018-10-01 11:17:01 |     NULL |       73 | NULL               | NULL       |              670 |       NULL |    1947 |
|               4359 |                      NULL |          1471 |          2 |        1 | 2019-12-06 21:49:06 | 2019-12-06 21:49:06 |     NULL |       25 | NULL               | NULL       |             3115 |       NULL |    3791 |
|               4364 |                      4359 |          1471 |          4 |        1 | 2019-12-06 21:49:06 | 2019-12-09 14:50:02 |      493 |       25 | NULL               | NULL       |             3115 |        523 |    3796 |
+--------------------+---------------------------+---------------+------------+----------+---------------------+---------------------+----------+----------+--------------------+------------+------------------+------------+---------+
12 rows in set (0.01 sec)

How can I fix this?

Hi @eddoff,

Off the top of my head, I think the safest solution would be to update those files so that they “belong” to your administrator account. To change the ownership of a file by submission_file_id, you can execute:

UPDATE submission_files SET uploader_user_id = XYZ WHERE submission_file_id IN (1226, 1227, 1339, 1617, 1618, 1827, 1833, 2142, 2282, 2508, 4359, 4364);

…replacing XYZ with the ID of your administrator’s account (see the user_id column in the users table if you’re not sure).

Make sure to take a complete backup of your database before working with it directly.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thank you @asmecher !

Seems to work! Some of them can now be deleted.

However, there are still some problems in deleting submissions from the deleted journal. Could there be other problems here?

[root@ojs tools]# php deleteSubmissions.php 1
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('1')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('1')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[root@ojs tools]# php deleteSubmissions.php 337
[root@ojs tools]# php deleteSubmissions.php 361
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('361')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('361')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[root@ojs tools]# php deleteSubmissions.php 364
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('364')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('364')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[root@ojs tools]# php deleteSubmissions.php 428
[root@ojs tools]# php deleteSubmissions.php 429
PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php:78
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/notification/PKPNotificationManager.inc.php(338): PKPEditingProductionStatusNotificationManager->updateNotification(Object(Request), NULL, 1048585, 429)
#1 /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php(562): PKPNotificationManager->updateNotification(Object(Request), Array, NULL, 1048585, 429)
#2 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#3 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('429')
#4 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('429')
#5 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#6 {main}
  t in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php on line 78
[root@ojs tools]# php deleteSubmissions.php 430
PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php:78
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/notification/PKPNotificationManager.inc.php(338): PKPEditingProductionStatusNotificationManager->updateNotification(Object(Request), NULL, 1048585, 430)
#1 /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php(562): PKPNotificationManager->updateNotification(Object(Request), Array, NULL, 1048585, 430)
#2 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#3 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('430')
#4 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('430')
#5 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#6 {main}
  t in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php on line 78
[root@ojs tools]# php deleteSubmissions.php 431
PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php:78
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/notification/PKPNotificationManager.inc.php(338): PKPEditingProductionStatusNotificationManager->updateNotification(Object(Request), NULL, 1048585, 431)
#1 /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php(562): PKPNotificationManager->updateNotification(Object(Request), Array, NULL, 1048585, 431)
#2 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#3 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('431')
#4 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('431')
#5 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#6 {main}
  t in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php on line 78
[root@ojs tools]# php deleteSubmissions.php 530
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('530')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('530')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[root@ojs tools]# php deleteSubmissions.php 531
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('531')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('531')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[root@ojs tools]# php deleteSubmissions.php 532
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('532')
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('532')
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597

Hi @eddoff,

This is a different issue, and is filed for attention here: Add ability to include user/context with CLI request · Issue #7604 · pkp/pkp-lib · GitHub

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher

I was able to now remove all submissions with error in getUsername(). However, the getId errors were harder to remove. Can you help me where to find where the NULL value for the context id is found, so that it can be changed, and the submissions can be removed?
Can it be that journal with journal_id = 1 is removed and journal_id = 1 is missing in the journals table?

Hi @eddoff,

Can you post the complete error message?

Regards,
Alec Smecher
Public Knowledge Project Team

Dear @asmecher

The original problem that the review reminders are not sent did not give any error messages (what I could find). And now suddenly the script started working! - I don’t know why and how! But Saturday morning the cron job was run, and according to review_assignments table a lot of emails were sent!

However, I still have some orphan submissions left.

MariaDB [ojs]> SELECT s.submission_id, s.context_id FROM submissions s LEFT JOIN journals j ON (s.context_id = j.journal_id) WHERE j.journal_id IS NULL;
+---------------+------------+
| submission_id | context_id |
+---------------+------------+
|           429 |          1 |
|           430 |          1 |
|           431 |          1 |
+---------------+------------+
3 rows in set (0.00 sec)

This is the error from trying to delete a submission without journal:

# php deleteSubmissions.php 429
PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php:78
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/notification/PKPNotificationManager.inc.php(338): PKPEditingProductionStatusNotificationManager->updateNotification(Object(Request), NULL, 1048585, 429)
#1 /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php(562): PKPNotificationManager->updateNotification(Object(Request), Array, NULL, 1048585, 429)
#2 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete(Object(SubmissionFile))
#3 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById('429')
#4 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById('429')
#5 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#6 {main}
  t in /var/www/html/journal/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php on line 78

@eddoff

Hi @eddoff,

That bug has already been fixed in OJS 3.3.0-9 and newer:

Regards,
Alec Smecher
Public Knowledge Project Team

Great!
I will try to update then :slight_smile:

Dear @asmecher

I tested with a cloned and updated version of OJS to 3.3.0-10. Then I get the following error:

php deleteSubmissions.php 429
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS) in /var/www/html/journal/lib/pkp/classes/core/PKPApplication.inc.php on line 230

I don’t know if this is related or another issue?

Hi @eddoff,

I suspect you’re running too old a version of PHP. Try running:

php --version

Note that your web server might be running a newer version than what you get when running PHP on the command line; I’ve seen may CPanel-based hosts operate that way.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks!

I have php 8.0 installed, but by some reason the version 5 was enabled!

Now it works to remove the submissions even if I get an error message:

[tools]# php deleteSubmissions.php 429
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:597
Stack trace:
#0 /var/www/html/journal/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(129): PKP\Services\PKPSubmissionFileService->delete()
#1 /var/www/html/journal/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById()
#2 /var/www/html/journal/tools/deleteSubmissions.php(56): SubmissionDAO->deleteById()
#3 /var/www/html/journal/tools/deleteSubmissions.php(62): SubmissionDeletionTool->execute()
#4 {main}
  thrown in /var/www/html/journal/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 597
[tools]# php deleteSubmissions.php 429
[tools]#

Hi @eddoff,

That’s this issue:

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 32 days. New replies are no longer allowed.