Fatal ERROR when rebuildSearchIndex.php

Recently we upgraded from ojs2.4 to ojs3.3 and when we try to rebuild the search index we this error and nothing in the logs.

$ php rebuildSearchIndex.php
Clearing index … done
Indexing “My Journal” … Syntax Warning: Invalid Font Weight
Syntax Warning: Invalid Font Weight
Syntax Warning: Invalid Font Weight



PHP Fatal error: Uncaught Error: Call to a member function getData() on null in /var/web1/ojs33/classes/search/ArticleSearchIndex.inc.php:38
Stack trace:
#0 /var/web1/ojs33/classes/search/ArticleSearchIndex.inc.php(280): ArticleSearchIndex->submissionMetadataChanged(Object(Submission))
#1 /var/web1/ojs33/tools/rebuildSearchIndex.php(59): ArticleSearchIndex->rebuildIndex(true, Object(Journal), Array)
#2 /var/web1/ojs33/tools/rebuildSearchIndex.php(75): rebuildSearchIndex->execute()
#3 {main}
thrown in /var/web1/ojs33/classes/search/ArticleSearchIndex.inc.php on line 38

Hi @isaac.marco,

Not sure about this error (I’ll see about getting someone else to assist), but just a heads up that upgrading from OJS 2.x to OJS 3.3 is not recommended: OJS/OMP/OPS 3.3 Release Notebook - OJS/OMP/OPS - did you upgrade to OJS 3.2 as an interim step?

-Roger
PKP team

As you said before the final upgrade to 3.3, previously I upgraded to stable-3_2_1.

classes/search/ArticleSearchIndex.inc.php line 38 refers to authors. May some submission is with no authors. I will try to put some debug in order to find the subission with problems.

I have found the problem happens when the ArticleSearchIndex try to index our article with issue_id=301 which is missing in our issues table.

Some help would be appreciated.

I believe to have solved the problem.

After the upgrade to 3.3 our editors were deleting old articles they had in the “All active” submissions tab. They were declining some articles and later deleting them from the “Archive” tab.

By some reason the deletion of these articles failed in articles with copy edited files. After delete the articles existed in table submissions but they were missing in the publications table.

This query was used to find these articles:

select * from submissions where submission_id not in (select submission_id from publications);

I found those articles were referenced in these other tables:

  • edit_decisions
  • referrals
  • review_rounds
  • stage_assignments
  • submission_files
  • submissions

but they were missing in the publications table. I found these references searching in phpmyadmin looking for tables with submission_id columns with the values I had missing in the publications table.

This was the cause of the failure when I tried to rebuild the index with the rebuildSearchIndex.php. Later, I discovered another problem: the list of submissions archive tab failed in the pages were those articles should be listed.

I tried to run the tool deleteSubmissions.php but this error occuried:

PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /home/isaac.marco/git/ojs33/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php:78

Finally I have deleted manually all the references in the database and the files in the filesystem and everything seems to be working OK now, but I have doubts if some other reference in other tables could be present and should be required to be manually deleted.

I think this data corruption has happened by some bug. If the PKP developers team are interested I could try to reproduce the manual delete in order to write a reproducible case.

Some comment would be appreciated in order to be sure my way to solve the problem is OK and no data corruption is still present in my database.

Thank you.

Hi @isaac.marco,

I suspect there was a failure during the submission deletion that resulted in a PHP error being logged (which is different from the Call to a member function getId() on null... entry as you’ve noted afterwards). Do you have that first PHP error log entry?

See Make submission deletion more accepting of missing files · Issue #6860 · pkp/pkp-lib · GitHub for a possible explanation.

Regards,
Alec Smecher
Public Knowledge Project Team

I haven’t found similar “Slim Application Error” in my production server but I have been able to reproduce a similar error in my local environment but there was no “File not found messages”.

Before this test I have tried to download all the files attached to the article and everything was OK.

You can see a recording with my test here https://youtu.be/5OVDXgtCfo0

This is the error in apache logs.

[Fri Mar 12 20:45:24.153764 2021] [php7:notice] [pid 13860] [client 127.0.0.1:53392] Slim Application Error:
Type: Error
Message: Call to a member function getId() on null
File: /home/isaac.marco/git/ojs24/lib/pkp/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php
Line: 102
Trace: #0 /home/isaac.marco/git/ojs24/lib/pkp/classes/notification/PKPNotificationManager.inc.php(338): PKPEditingProductionStatusNotificationManager->updateNotification(Object(Request), NULL, 1048585, 301)
#1 /home/isaac.marco/git/ojs24/lib/pkp/classes/services/PKPSubmissionFileService.inc.php(562): PKPNotificationManager->updateNotification(Object(Request), Array, NULL, 1048585, 301)
#2 /home/isaac.marco/git/ojs24/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(128): PKP\\Services\\PKPSubmissionFileService->delete(Object(SubmissionFile))
#3 /home/isaac.marco/git/ojs24/classes/submission/SubmissionDAO.inc.php(51): PKPSubmissionDAO->deleteById(301)
#4 /home/isaac.marco/git/ojs24/lib/pkp/classes/submission/PKPSubmissionDAO.inc.php(103): SubmissionDAO->deleteById(301)
#5 /home/isaac.marco/git/ojs24/lib/pkp/classes/services/PKPSubmissionService.inc.php(783): PKPSubmissionDAO->deleteObject(Object(Submission))
#6 /home/isaac.marco/git/ojs24/lib/pkp/api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php(197): PKP\\Services\\PKPSubmissionService->delete(Object(Submission))
#7 [internal function]: PKPBackendSubmissionsHandler->delete(Object(Slim\\Http\\Request), Object(APIResponse), Array)
#8 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func(Array, Object(Slim\\Http\\Request), Object(APIResponse), Array)
#9 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(281): Slim\\Handlers\\Strategies\\RequestResponse->__invoke(Array, Object(Slim\\Http\\Request), Object(APIResponse), Array)
#10 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\Route->__invoke(Object(Slim\\Http\\Request), Object(APIResponse))
#11 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/Route.php(268): Slim\\Route->callMiddlewareStack(Object(Slim\\Http\\Request), Object(APIResponse))
#12 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/App.php(503): Slim\\Route->run(Object(Slim\\Http\\Request), Object(APIResponse))
#13 /home/isaac.marco/git/ojs24/lib/pkp/classes/security/authorization/internal/ApiAuthorizationMiddleware.inc.php(77): Slim\\App->__invoke(Object(Slim\\Http\\Request), Object(APIResponse))
#14 [internal function]: ApiAuthorizationMiddleware->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Slim\\App))
#15 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(ApiAuthorizationMiddleware), Array)
#16 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Slim\\App))
#17 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Slim\\App))
#18 /home/isaac.marco/git/ojs24/lib/pkp/classes/security/authorization/internal/ApiCsrfMiddleware.inc.php(46): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#19 [internal function]: ApiCsrfMiddleware->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#20 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(ApiCsrfMiddleware), Array)
#21 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#22 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#23 /home/isaac.marco/git/ojs24/lib/pkp/classes/security/authorization/internal/ApiTokenDecodingMiddleware.inc.php(121): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#24 [internal function]: ApiTokenDecodingMiddleware->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#25 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(ApiTokenDecodingMiddleware), Array)
#26 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#27 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#28 /home/isaac.marco/git/ojs24/lib/pkp/classes/handler/APIHandler.inc.php(68): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#29 [internal function]: APIHandler->{closure}(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#30 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#31 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#32 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#33 /home/isaac.marco/git/ojs24/lib/pkp/classes/handler/APIHandler.inc.php(127): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#34 [internal function]: APIHandler->{closure}(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#35 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#36 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#37 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#38 /home/isaac.marco/git/ojs24/lib/pkp/classes/handler/APIHandler.inc.php(132): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#39 [internal function]: APIHandler->{closure}(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#40 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#41 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#42 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#43 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\\App->Slim\\{closure}(Object(Slim\\Http\\Request), Object(APIResponse))
#44 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/App.php(392): Slim\\App->callMiddlewareStack(Object(Slim\\Http\\Request), Object(APIResponse))
#45 /home/isaac.marco/git/ojs24/lib/pkp/classes/handler/APIHandler.inc.php(124): Slim\\App->process(Object(Slim\\Http\\Request), Object(APIResponse))
#46 [internal function]: APIHandler->{closure}(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#47 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(Closure), Array)
#48 [internal function]: Slim\\DeferredCallable->__invoke(Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#49 /home/isaac.marco/git/ojs24/lib/pkp/lib/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\\DeferredCallable), Object(Slim\\Http\\Request), Object(APIResponse), Object(Closure))
#50 /home/isaac.ma

I have another shot with the other article in my local environment I you want me to try something.

Hi @isaac.marco,

The commit I applied to the above issue (pkp/pkp-lib#6860 Be more accepting of missing files and entities · pkp/pkp-lib@c2b02c4 · GitHub) should resolve the error message you see above, among other things. If it’ll apply cleanly to your installation, I’d recommend giving it a try. It fixes both some conditions that lead to errors during submission deletion, and some errors arising from the resulting partial entities in the database.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thank you @ asmecher,

well, I have applied your patch and it looks to be working.

I have deleted my other article with problems an no errors occurred but I still have one record in the referreals table with the submission_id I have deleted.

It has also been solved the error I got when listing archived articles in the page where deleted articles lived, not just for this deleted article but also for the yesterday partially deleted article. Good.

By other hand tool/deleteSubmissions.php still give me the same error when I have tried to completely remove the partial deleted article but not sure if it should be solved.