This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with creating, saving, and publishing posts when WPML plugins are activated, leading to long processing times for queries. This problem is observed in the production environment, and the client has provided relevant logs and stack traces.
Solution: We recommend the following steps to identify and resolve the issue: 1. Provide screenshots showing the difference in loading times with WPML plugins activated and deactivated. 2. Provide debug information from your site by following the steps here: https://wpml.org/faq/provide-debug-information-faster-support/ 3. Create a full backup of your site or set up a staging site as a copy of the live site. 4. Update any outdated plugins or themes and flush any existing cache memory. 5. Deactivate all plugins, including WPML, and activate a default WordPress theme like Twenty Twenty. 6. Reactivate the WPML plugins and check if the performance issue persists. If it does, reactivate the theme and other plugins one by one to identify the culprit. 7. Enable debug mode by following the steps here: https://wordpress.org/support/article/debugging-in-wordpress/ and check for error messages in the debug.log file within the wp-content folder.
If these steps do not resolve the issue or if the solution seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
We would like to seek your help as we are having difficulties creating, saving and publishing certain posts on our site.
By looking at the new relic logs, it appears the queries from WPML are taking long time to process.
This one specific request appear to be the cause
WPML_Media_Post_With_Media_Files::_get_ids_from_media_array
It appears that we need to optimize the setting for WPML and would greatly appreciate
if you can help us in the regard.
Please kindly help us identify the problem and the solution to the problem.
We've replicated the production environment to the following environment.
We can also provide logs as well as access to New Relic tool as needed to diagnose the problem
Below is the query and stack trace New Relic provided when that page was updated.
in mysqli_query called at /nas/content/live/kbwalkme/wp-includes/class-wpdb.php (2187)
in wpdb::_do_query called at /nas/content/live/kbwalkme/wp-includes/class-wpdb.php (2076)
in wpdb::query called at /nas/content/live/kbwalkme/wp-includes/class-wpdb.php (2816)
in wpdb::get_col called at /nas/content/live/kbwalkme/wp-includes/class-wp-query.php (3262)
in WP_Query::get_posts called at /nas/content/live/kbwalkme/wp-includes/class-wp-query.php (3749)
in WP_Query::query called at /nas/content/live/kbwalkme/wp-includes/class-wp.php (663)
in WP::query_posts called at /nas/content/live/kbwalkme/wp-includes/class-wp.php (783)
in WP::main called at /nas/content/live/kbwalkme/wp-includes/functions.php (1332)
in wp called at /nas/content/live/kbwalkme/wp-blog-header.php (16)
in require called at /nas/content/live/kbwalkme/index.php (17)
1.- Could you provide some screenshots where we can see the difference in loading time when the WPML plugins are activated/deactivated when the creating/saving posts are performed so we can see the problem?
2.- Please provide the debug information of the site in the section that appears below this ticket
In order to isolate the cause of the issue I kindly ask you to follow these steps:
- Create a full backup of the site or create a staging site with a copy of the live site
- Update any outdated plugins or themes
- Flush any cache memory that might exists
- Deactivate all plugins, including WPML ones
- Activate a default WordPress theme, like Twenty Twenty
- Activate the WPML plugins
- If the performance issue disappeared, then start by activating the theme and then the plugins, one by one, until the issue appears again and you find the culprit
Could you tell me the results of the steps described above?
First of all, we are getting this issue only on my production environment and so we cannot follow all the steps as you mentioned above.
Can you please tell me that another user was facing the same problem, so what was your solution to resolve his issue? https://wpml.org/forums/topic/high-cpu/
In your first message (https://wpml.org/forums/topic/high-cpu-usage-wpml/#post-12905345) you mentioned that "We've replicated the production environment to the following environment." so I understood that you were able to replicate the issue in the dev environment.
If you cannot reproduce the performance problem in the dev site, it means that the cause of the issue is not WPML.
If the issue persists in the dev environment, then WPML might be related to this issue but we need to determine who is really causing the problem.
In order to isolate the cause of the issue, the steps I described in my previous message must be followed, in the production or in the dev environment, but it's the way to find out who is the culprit.
I also recommend you activate the debug mode in the site by following the steps described in this link: https://wordpress.org/support/article/debugging-in-wordpress/ and checking if there are any error messages in the debug.log file located within the wp-content folder.