Activity log doesn't load [OJS 3.3.0.6]

We are having an issue with OJS 3.3.0.6 where the Activity Log window doesn’t load for certain (not all) submissions.

image

This is the error log:

[Wed Jun 16 14:23:58.143300 2021] [php7:notice] [pid 72072] [client REMOVED FOR PRIVACY REASONS :60673] PHP Notice: Undefined index: stageId in /var/www/submission_scielo_br/htdocs/lib/pkp/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php on line 111, referer: https://homolog-submission.scielo.br/index.php/resr/workflow/index/250494/1
[Wed Jun 16 14:23:58.234371 2021] [php7:error] [pid 72072] [client REMOVED FOR PRIVACY REASONS :60673] PHP Fatal error: Uncaught Error: Call to a member function getAssocId() on null in /var/www/submission_scielo_br/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:774\nStack trace:\n#0 /var/www/submission_scielo_br/htdocs/lib/pkp/controllers/grid/eventLog/EventLogGridRow.inc.php(79): PKP\Services\PKPSubmissionFileService->getWorkflowStageId(Object(SubmissionFile))\n#1 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1066): EventLogGridRow->initialize(Object(Request))\n#2 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(983): GridHandler->_getInitializedRowInstance(Object(Request), 33, Object(SubmissionEventLogEntry))\n#3 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1031): GridHandler->renderRowsInternally(Object(Request), Array)\n#4 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(921): GridHandler->renderGridBodyPartsInternally(Object(Request))\n#5 /va in /var/www/submission_scielo_br/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 774, referer: https://homolog-submission.scielo.br/index.php/resr/workflow/index/250494/1

Hi @alexxxmendonca

This is probaby an orphaned submission file attached to a note in a discussion. If you’re willing to do a bit of debugging, you can add an error_log() statement just before line 774 in lib/pkp/classes/services/PKPSubmissionFileService.inc.php and try:

error_log($submissionFile->getFileId());

To figure out what submission file to look at in the database. The assoc_id column would normally be the id for the note, but I suspect it doesn’t point to a valid one. You can probably find the file on the file system, save it for your editors, and then delete the submission file record.

Cheers,
Jason

1 Like

Hi @alexxxmendonca

I have faced the same issue and as a temporary solution I have changed in lib/pkp/classes/services/PKPSubmissionFileService.inc.php lines 774 and 775 to just one line

//$query = $queryDao->getById($note->getAssocId());
//return $query ? $query->getStageId() : null;
return null;

As all the important information I need still showed up after the change.

Also, in case it keeps loading with no errors shown in the PHP error log, disable the Ad blocker as it blocked the request for me for some reason.

Hope that helps.

Hi,

A small modification for the solution above as it seems it broke the download system for the files in discussions and always displays either:
You have not been assigned to this submission with a role that is allowed to access this operation.
or
The current role does not have access to this operation.

as it can no longer get the file. So the modification is as follows:

again in lib/pkp/classes/services/PKPSubmissionFileService.inc.php lines 774 and 775 to the following lines:

try {
$query = $queryDao->getById($note->getAssocId());
return $query ? $query->getStageId() : null;
}
catch (Exception $e) {
return null;
}

@jnugent Looking at my file on line 774 I didn’t find this part you mentioned, see the print of my configuration

Screen Shot 2021-06-22 at 15.37.50

@GoudaO, Hello how are you? I made the adjustments and was unsuccessful, the error persisted.

Thanks, GoudaO! Modifying the file and turning off the AdBlocker did the job: now the Activity Log History loads fine (ojs 3.3.0-7).

@tkomives how can i turn off adblobker?

Hi @Elton_Pereira_Leite, if the problem of not displaying logs only occurs for certain articles, then adblocker should not be the cause.

If you’re using Firefox or Chrome and you haven’t installed/enabled an adblocker, there probably isn’t one you need to disable. The problem is on the server side (code / PHP).

@Elton_Pereira_Leite , see this tip sent by Israel in another post:

Does it solve your problem too?

Thanks for this – turned out my AdBlocker plugin was blocking at least part of the JS from loading. Turning off the AdBlocker on my journal’s site let the Activity Log load properly.

@jnugent I inserted the error_log, it’s returning this to me, can you help me?

[Sex 17 de setembro 14: 19: 35.540154 2021] [php7: aviso] [pid 17607] [cliente Oculto] Aviso de PHP: Índice indefinido: stageId em / var / www / submit_scielo_br / htdocs / lib / pkp / controllers / grid / eventLog /SubmissionEventLogGridHandler.inc.php na linha 111, referenciador: https: //oculto/index.php/resr/workflow/index/250494/1
[Sex Set 17 14: 19: 36.024663 2021] [php7: error] [pid 17607] [cliente Oculto PHP Erro fatal: Erro não detectado: Chamada para método indefinido SubmissionFile :: getFileId () em / var / www / submit_scielo_br / htdocs / lib / pkp / classes / services / PKPSubmissionFileService.inc.php: 774 \ nStack trace: \ n # 0 /var/www/submission_scielo_br/htdocs/lib/pkp/controllers/grid/eventLog/EventLogGridRow.inc.php(79) : PKP \ Services \ PKPSubmissionFileService-> getWorkflowStageId (Object (SubmissionFile)) \ n # 1 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1066): EventLogR initialize (Object (Request)) \ n # 2 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(983): GridHandler → _ getInitializedRowInstance (Object (Request), 54 ,Object (SubmissionEventLogEntry)) \ n # 3 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1031): GridHandler-> renderRowsInternally (Object (Request), Array) \ n # 4 /var/www/submission_scielo_br/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(921): GridHandler-> renderGridBodyPartsInternally (Object (Request)) \ n in / var / www / submit_scielo_br /htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php na linha 774, referenciador: https: //Oculto/index.php/resr/workflow/index/250494/1renderGridBodyPartsInternally (Object (Request)) \ n em /var/www/submission_scielo_br/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php na linha 774, referenciador: https: //Oculto/index.php/resr/ fluxo de trabalho / índice / 250494/1renderGridBodyPartsInternally (Object (Request)) \ n em /var/www/submission_scielo_br/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php na linha 774, referenciador: https: //Oculto/index.php/resr/ fluxo de trabalho / índice / 250494/1

Hi @Elton_Pereira_Leite

This is probably a bug that has been fixed in newer versions of 3.3. In your error, there is an undefined method being called on a $submissionFile object. I’d recommend a quick upgrade to 3.3.0.8 first to see if that solves the problem. Much of that code has been worked on since 3.3.0.6 was released.

Best
Jason

@jnugent

I’m using the latest version of OJS 3.3.0-8, but I’m still having this problem see my log:

[Mon Nov 08 15:17:32.390866 2021] [php7:notice] [pid 11335] [client 10.81.234.8:56768] PHP Notice: Undefined index: stageId in /var/www/oculto/htdocs/lib/pkp/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php on line 111, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1
[Mon Nov 08 15:17:32.602845 2021] [php7:error] [pid 11335] [client 10.81.234.8:56768] PHP Fatal error: Uncaught Error: Call to a member function getAssocId() on null in /var/www/oculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:774\nStack trace:\n#0 /var/www/oculto/htdocs/lib/pkp/controllers/grid/eventLog/EventLogGridRow.inc.php(79): PKP\Services\PKPSubmissionFileService->getWorkflowStageId(Object(SubmissionFile))\n#1 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1066): EventLogGridRow->initialize(Object(Request))\n#2 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(983): GridHandler->_getInitializedRowInstance(Object(Request), 84, Object(SubmissionEventLogEntry))\n#3 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1031): GridHandler->renderRowsInternally(Object(Request), Array)\n#4 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(921): GridHandler->renderGridBodyPartsInternally(Object(Request))\n#5 /va in /var/www/spculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 774, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1
[Mon Nov 08 15:17:55.843332 2021] [php7:notice] [pid 11668] [client 10.81.234.8:52174] PHP Notice: Undefined index: stageId in /var/www/ocultor/htdocs/lib/pkp/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php on line 111, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1
[Mon Nov 08 15:17:56.086265 2021] [php7:error] [pid 11668] [client 10.81.234.8:52174] PHP Fatal error: Uncaught Error: Call to a member function getAssocId() on null in /var/www/oculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:774\nStack trace:\n#0 /var/www/oculto/htdocs/lib/pkp/controllers/grid/eventLog/EventLogGridRow.inc.php(79): PKP\Services\PKPSubmissionFileService->getWorkflowStageId(Object(SubmissionFile))\n#1 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1066): EventLogGridRow->initialize(Object(Request))\n#2 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(983): GridHandler->_getInitializedRowInstance(Object(Request), 84, Object(SubmissionEventLogEntry))\n#3 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1031): GridHandler->renderRowsInternally(Object(Request), Array)\n#4 /var/www/socultor/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(921): GridHandler->renderGridBodyPartsInternally(Object(Request))\n#5 /va in /var/www/oculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 774, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1
[Mon Nov 08 15:18:00.536132 2021] [php7:notice] [pid 11335] [client 10.81.234.8:63946] PHP Notice: Undefined index: stageId in /var/www/oculto/htdocs/lib/pkp/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php on line 111, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1
[Mon Nov 08 15:18:00.762243 2021] [php7:error] [pid 11335] [client 10.81.234.8:63946] PHP Fatal error: Uncaught Error: Call to a member function getAssocId() on null in /var/www/oculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:774\nStack trace:\n#0 /var/www/oculto/htdocs/lib/pkp/controllers/grid/eventLog/EventLogGridRow.inc.php(79): PKP\Services\PKPSubmissionFileService->getWorkflowStageId(Object(SubmissionFile))\n#1 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1066): EventLogGridRow->initialize(Object(Request))\n#2 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(983): GridHandler->_getInitializedRowInstance(Object(Request), 84, Object(SubmissionEventLogEntry))\n#3 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1031): GridHandler->renderRowsInternally(Object(Request), Array)\n#4 /var/www/oculto/htdocs/lib/pkp/classes/controllers/grid/GridHandler.inc.php(921): GridHandler->renderGridBodyPartsInternally(Object(Request))\n#5 /va in /var/www/oculto/htdocs/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 774, referer: https://oculto.scielo.br/index.php/resr/workflow/index/250494/1

Hi @Elton_Pereira_Leite

This is something different. The error below:

Is this line in the code:

$query = $queryDao->getById($note->getAssocId());

So what is happening here is that you’ve got files in the submission_files table that have assoc_id values that are supposed to be notes (discussion query posts) but are actually not there.

you’ll probably need to spend some time looking at the submission files table and find files with an assoc_type of SUBMISSION_FILE_QUERY that have assoc_ids that do not exist in the notes table, and clean them up. It’s little more hassle to do that in 3.3 now because there is also the files table to consider, and the files table has a foreign key relationship with the submission_files table.

Best,
Jason

@jnugent do you indicate which command I can use to perform the query and delete? I don’t know much about the structure of the OJS bank

I’d recommend getting a developer to look at this because you can do damage to your OJS database if you are unsure of what you are doing. If there is someone you know, feel free to get them involved in this thread and I can provide some details. It’s not as simple as a query, I’m afraid.

Best
Jason

Hi @Elton_Pereira_Leite

Here are some database queries to get you started. This query will find submission files that are supposed to be attached to notes, but are not because the notes are gone

SELECT * FROM submission_files WHERE assoc_type = '520' AND assoc_id NOT IN (SELECT note_id from notes)

If you get any records back from that, you can use the file_id of those records to clean out corresponding records in the submission_file_settings, submission_file_revisions, and files tables.

For the latter two, there is a foreign key constraint on the file_id (this is new in OJS 3.3) and so if you are deleting records via PHPMyAdmin you’ll need to uncheck the box that says “Enable foreign key checks” or the command will fail. The files table records for those orphaned files will contain the path to the file on disk, in case you want to send them to the editor since once you delete the records from the database they’ll no longer be accessible on the workflow.

Please make a backup of your database before running these commands since there is no way to undo this except via a restore.

Best,
Jason

1 Like

@jnugent Hello we found the solution, we ran the commands below and solved it, thanks for the support, we can close this ticket.

SELECT sf.submission_file_id FROM submission_files sf LEFT JOIN notes n ON (sf.assoc_id = n.note_id) WHERE sf.assoc_type = 520 AND n.note_id IS NULL;

DELETE FROM submission_file_revisions WHERE submission_file_id IN (SELECT sf.submission_file_id FROM submission_files sf LEFT JOIN notes n ON (sf.assoc_id = n.note_id) WHERE sf.assoc_type = 520 AND n.note_id IS NULL);

delete from submission_files where submission_file_id in (
SELECT sfid FROM (SELECT sf.submission_file_id AS sfid FROM submission_files sf
LEFT JOIN notes n ON (sf.assoc_id = n.note_id) WHERE sf.assoc_type = 520 AND n.note_id IS NULL) AS c);

4 Likes

Hi all,

This appears to be the issue also under discussion here:

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like