[OJS 3.2.1.4] Published and unpublished stay loading too long

Hi,

At the time of published or unpublished issue in the OJS 3.2.1.4, it stays loading too long and it is time to reload the page again to see if I do the action.

Unpublished:

image

image

image

Published:

image

And it shows me the following error:

image

Hi @asmecher, @astevens, @NateWr,

What can I do or what patch can I apply for my OJS version 3.2.1.4, which will allow me to improve and speed up the loading and display when publishing and unpubished an article?

Hi,

Any answer or solution?

Hi @diegomejia07,

Couple of questions to help figure out what’s going on:

  1. Does the article publish eventually finish and close the modal on its own or does it always give you that error in the console?
  2. If you do refresh the page, does the article appear as successfully published?
  3. Is there anything related to this in the server error logs?
  4. Is this happening on a large installation and/or did problems with slow publishing happen over time as the installation got larger.

Thanks.

Regards,

Erik
PKP Team

Hi @ewhanson,

I answer your questions:

  1. I always get an error on the console.
  2. After I update the page the article is unpublished normally.
  3. On the server there is no error log in the logs.
  4. Yes, the installation I have is very large, but this started to happen after updating to version 3.2.1.4.

But when it is published it shows me the following:

image

And it comes back and stays there, but if I reload the page the publication was made.

But there are times it shows me this, and if I press the button again, the following error will appear:

image

Hi @diegomejia07,

Thanks for sharing that. Regarding the error in the first image: could you also share a screenshot with the network tab that show the request that’s failing was and possibly the response it’s returning? It’s probably one of the XHR requests.

The second error makes sense, because if the article has already been recorded as published, the system won’t let you publish it again, so once we have the underlying problem sorted, this should go away.

As for the speed, this is most likely because of the search index update that happens at the end of the publish step. Unfortunately, this is a known issue, especially with large installations. This post is on slow file uploads, but it’s related to the search index. Increasing the max_execution_time and other such PHP settings as described in the thread below may help as well. This won’t speed anything up, but it may stop the publish step from failing.

And the relevant section of the publish code can be found here:

If none of this works for you, another place to look might be to see what the actual SQL queries are for the indexing process and which of those are the slowest.

Thanks.

Regards,

Erik
PKP Team

Hi @ewhanson,

This is what is shown in the network tab when the error is triggered:

image

It could be some of the database, I don’t know the characters, the engine that is innoDB or MyISAM, or what else could it be, or update to a version 3.3. The truth is if I need to solve this, since this platform is productive.

Hi @diegomejia07,

Thanks. Would you be able to share what the network tab looks like after trying to publish as well?

As a short-term solution, you could try increasing the max_execution_time in your php.ini settings. Let me know if increasing this helps.

Regards,

Erik
PKP Team

Hi @ewhanson,

When publish the following is shown:

image

I have already uploaded the value of the max_execution_time variable in the php.ini, and it does not improve the response at all

Do you think it is better to update again to a version like 3.3, or that there is something that is blocking the requests on the server?

Regarding keywords indexing, in the next major release (OJS 3.4), the algorithm is slightly improved, which should perform better in large installations, see: Publishing with a XML galley slow with lots of PHP notices · Issue #6303 · pkp/pkp-lib · GitHub

Hi @Vitaliy and @ewhanson

It greatly improves the speed in the unpublished and publishe of the articles, but I still have the same error when trying to publish.

image

Uncaught TypeError: Cannot read properties of undefined (reading 'trigger')
    at b.a.pkp.controllers.modal.ModalHandler.modalOpen (pkp.min.js?v=3.2.1.4:317)
    at wi.ajaxErrorCallback (build.js?v=3.2.1.4:8)
    at Object.error (build.js?v=3.2.1.4:8)
    at u (jquery.min.js?v=3.2.1.4:2)
    at Object.fireWith [as rejectWith] (jquery.min.js?v=3.2.1.4:2)
    at k (jquery.min.js?v=3.2.1.4:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js?v=3.2.1.4:2)
a.pkp.controllers.modal.ModalHandler.modalOpen @ pkp.min.js?v=3.2.1.4:317
ajaxErrorCallback @ build.js?v=3.2.1.4:8
error @ build.js?v=3.2.1.4:8
u @ jquery.min.js?v=3.2.1.4:2
fireWith @ jquery.min.js?v=3.2.1.4:2
k @ jquery.min.js?v=3.2.1.4:2
(anónimo) @ jquery.min.js?v=3.2.1.4:2
load (asíncrono)
send @ jquery.min.js?v=3.2.1.4:2
ajax @ jquery.min.js?v=3.2.1.4:2
unpublish @ build.js?v=3.2.1.4:8
callback @ build.js?v=3.2.1.4:8
a.pkp.controllers.modal.ConfirmationModalHandler.modalConfirm @ pkp.min.js?v=3.2.1.4:321
(anónimo) @ pkp.min.js?v=3.2.1.4:129
dispatch @ jquery.min.js?v=3.2.1.4:2
y.handle @ jquery.min.js?v=3.2.1.4:2
pkp.min.js?v=3.2.1.4:316 Uncaught TypeError: Cannot read properties of undefined (reading 'addClass')
    at pkp.min.js?v=3.2.1.4:316
(anónimo) @ pkp.min.js?v=3.2.1.4:316
setTimeout (asíncrono)
a.pkp.controllers.modal.ModalHandler.modalOpen @ pkp.min.js?v=3.2.1.4:316
ajaxErrorCallback @ build.js?v=3.2.1.4:8
error @ build.js?v=3.2.1.4:8
u @ jquery.min.js?v=3.2.1.4:2
fireWith @ jquery.min.js?v=3.2.1.4:2
k @ jquery.min.js?v=3.2.1.4:2
(anónimo) @ jquery.min.js?v=3.2.1.4:2
load (asíncrono)
send @ jquery.min.js?v=3.2.1.4:2
ajax @ jquery.min.js?v=3.2.1.4:2
unpublish @ build.js?v=3.2.1.4:8
callback @ build.js?v=3.2.1.4:8
a.pkp.controllers.modal.ConfirmationModalHandler.modalConfirm @ pkp.min.js?v=3.2.1.4:321
(anónimo) @ pkp.min.js?v=3.2.1.4:129
dispatch @ jquery.min.js?v=3.2.1.4:2
y.handle @ jquery.min.js?v=3.2.1.4:2
pkp.min.js?v=3.2.1.4:316 Uncaught TypeError: Cannot read properties of undefined (reading 'focus')
    at pkp.min.js?v=3.2.1.4:316

Also I get these errors:

POST /$$$call$$$/api/file/manage-file-api/save-metadata?submissionId=340766&stageId=5&reviewRoundId=&fileStage=17&fileId=238571 500 (Internal Server Error)

That improvement wasn’t backported to OJS 3.2.1 and won’t work without additional modifications.

Hi @Vitaliy and @ewhanson,

I have these errors before, I have already returned the change, but I have those errors since I updated, and I do not know if my server is blocking some post and put requests.

But it still seems to me that the patch would work very well for this version. There is a way to test and apply it in version 3.2

Hi @ewhanson,

I see that I am getting this error there:

jquery.min.js?v=3.2.1.4:2 PUT /api/v1/submissions/340766/publications/65710/unpublish 500 (Internal Server Error)

image

 The cookie "xxxxxxxxxxxx" has been rejected because it has already expired.  publish
{"error": "api.404.endpointNotFound", "errorMessage": "The requested URL was not recognized."}

Hi @diegomejia07,

For the 500 error, what does the corresponding server error log entry look like?

For the second set of errors, I’m not sure what to suggest as this seems like a symptom of the slow publish execution time or from reattempting the publish request before it has finished executing on the server.

Have you tested the solution suggested in this post?

I would recommend trying this out on a test installation, but if this were to remove your errors, it would help narrow down exactly what is causing the errors you’ve shared. If this is all related to slow performance, you could try an upgrade to see if it works better on OJS 3.3, but the upgrade process from 3.2.1 to 3.3 on a large installation may be challenging (see: OJS 3.3 upgrade error · Issue #6724 · pkp/pkp-lib · GitHub).

Thanks.

Regards,

Erik
PKP Team

Hi @ewhanson,

  1. I solved the drawback of these javascript errors with the following. Check my database and modify the default_chararset to utf8 and the default_collation to utf8_general_ci of all my tables.

  2. Then modify the engine of all tables from MYISAM to InnoDB.

  3. And finally, launch the command php tools/rebuildSearchIndex.php, to re-establish the search index on the platform, and now the unpublished and published ones work correctly.

There are some tasks or actions that are still a bit slow, such as loading the back issues, but I will continue looking for a solution for this. Anyway, thank you very much for being aware and for your collaboration.

Hi @diegomejia07,

Happy to hear that helped. As @Vitaliy said, some of this should improve with the next major release of OJS (3.4).

Regards,

Erik
PKP Team