Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
When sending page for translation via Translation management I get an error:
"(12) Invalid state 'translating' to complete operation"

Solution:
There was an issue with Redis cache which creates objects from WordPress content which doesn't work well with WPML Translation Management. Fixed in the next release.

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.

This topic contains 17 replies, has 2 voices.

Last updated by Dražen Duvnjak 4 years, 4 months ago.

Assisted by: Dražen Duvnjak.

Author Posts
May 16, 2020 at 5:59 am #6145773

Dan

Hi Drazen,

Warning: A non-numeric value encountered in /var/www/vhosts/dev3.internetsociety.org/wp-content/plugins/wpml-translation-management/inc/translation-proxy/translationproxy-basket.class.php on line 132 Warning: A non-numeric value encountered in /var/www/vhosts/dev3.internetsociety.org/wp-content/plugins/wpml-translation-management/inc/translation-proxy/translationproxy-basket.class.php on line 132

and this one:
Sending your jobs to professional translation

(12) Invalid state 'translating' to complete operation
Rollback jobs...
Batch rolled back

So this is working now, but only if redis cache is cleared. As this isn't very convenient for editors, I would like to implement a mechanism that clears redis cache.

I see there is this contant that can be used:

define( 'WP_REDIS_IGNORED_GROUPS', [
"counts", // not sure what this ignores
"plugins", // this can't be used as it ignores too many elements
"themes",
"wpml" // is such a parameter available?
] );

Any idea if a "wpml" parameter exists for redis cache?
I have been digging and search a while but have not found anything.

May 16, 2020 at 6:08 am #6145779

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hi Dan,

I think this issue happens since Redis cache creates objects from WordPress content which doesn't work with WPML. I think we should try and find a fix for this issue since Redis is quite a popular server cache plugin.

Can you try adding WPML_TM_ICL_Translations::translations to the WP_REDIS_IGNORED_GROUPS array.

Let me know how it goes.

Thanks and regards,
Drazen

May 22, 2020 at 7:04 am #6192711

Dan

Hi Drazen,

Sorry it took us a bit of time to test this.

My colleague in charge of translations tested and it still doesn't work.

Here is the config I specified in the wp config:

define('WP_REDIS_IGNORED_GROUPS', [
"counts",
"plugins",
"themes",
"options",
"WPML_TM_ICL_Translations::translations",
]);

Here is the testing scenario:

- he sent one article off to translation.
- he verified it arrived at iCanLocalize
- he went back to our system and WITHOUT clearing the Redis cache, he sent a second article off.
- It failed with error 12 - see the attached screenshot
- he tried sending a third post and it again got the error 12.
- he reset the Redis cache and WAS successfully able to send the content off for translation.
- he also tried sending off one after the other and changing the batch names, in case there was an issue with conflicting with WPML batch names coming from the production server.
However, that did not work either. He still got error 12 on the second transmission.

Can you check and advise?
Thanks again!

Best,
Henri

get_asset.jpg
May 22, 2020 at 7:57 am #6193081

Dan

Hi Drazen,
Just to complete my last feedback, I just updated all wpml plugins and tested again exactly as my colleague did above.
The error 12 invalid state translating to complete operation will shop up and it rolls back the job.
Best,
Henri

May 22, 2020 at 8:31 am #6193257

Dan

Hi Drazen,

And a few php notices I bumped into on one of my dev sites:

Notice: Undefined index: wpml_cf_preferences in /app/public/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php on line 57

On pages such as:
wp-admin/edit-tags.php?taxonomy=category&post_type=post&s=IXP&lang=all
and:
wp-admin/post.php?post=94415&action=edit&lang=fr

Probably not vital but always good to eradicate.

Thanks,
Henri

May 22, 2020 at 11:34 am #6194995

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Henri,

thanks for sharing.

That is weird, it worked before with the same issues.

Can you please confirm it works fine after clearing Redis cache or when Redis cache disabled?

In order to investigate this issue and to understand it better, I would need to access your website.

Please share a page that I can use and that is causing this issue. Best would be some small test page with 1-2 sentences.

Please make a full backup of your site (files and database) and confirm it in your next reply. I might need to enable/disable plugins, switch themes and access your website database.

I would need to access both your site's wp-admin and FTP account. Be sure to provide both.

I have enabled the private username and password fields in your next reply.

I suggest you create a temporary user, set it as an administrator and then add those credentials in the private fields mentioned.

You can safely add your information into these fields.

Thanks,
Drazen

May 23, 2020 at 10:42 am #6200803

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for the staging site and information. It really helped me understand the issue and investigating it.

I have logged in to your staging site, checked the issue, and tried with different pages and with all other plugins disabled except for WPML plugins and Redis while using the WP default theme. The issue still exists, it worked only after clearing the cache or when sending it to a local translator.

Then I set up a sandbox on our servers and was able to replicate the issue on a clean install.

That confirms there are compatibility issues.

That being the case I have escalated this ticket to our compatibility team and they will be checking the issue and hopefully provide a solution.

I will be marking this ticket status as Escalated to Compatibility team and will update you as soon as I have some news.

Thank you for your patience.

Enjoy your weekend too, and talk to you soon.

Regards,
Drazen

June 5, 2020 at 8:50 am #6302733

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have an update from our developers.

Can you please try adding "TranslationProxy_Project" to WP Redis Ignored group to wp-config.php:

It should look something like this:

define('WP_REDIS_IGNORED_GROUPS', [
        "counts",
        "plugins",
        "themes",
        "options",
        "WPML_TM_ICL_Translations::translations",
        "TranslationProxy_Project",
        ]);

Please let me know how it goes and if it works for you.

Thanks,
Drazen

June 8, 2020 at 9:32 am #6319403

Dan

Hi Drazen,

It looks like it still doesn't work.

I have tried as indicated with the following parameters:

define('WP_REDIS_IGNORED_GROUPS', [
"counts",
"plugins",
"themes",
"options",
"WPML_TM_ICL_Translations::translations",
"TranslationProxy_Project",
]);

Steps to reproduce:
1. Clear caches: Redis, nginx and CDN
2. Sent an item for translation -> and that works
3. Sent another item for translation -> that does not work
Error message: (12) Invalid state 'translating' to complete operation. Rollback jobs...Batch rolled back

What do you think, should we try Redis Cache Pro? hidden link

Let me know,
Thank you!
Henri

June 8, 2020 at 2:29 pm #6322433

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for the reply.

If you have that ability it would be nice if you can check with some other Redis plugins, since on our test site we managed to fix the issue with Redis Object cache by adding the mentioned code. But your environment might be different, and it is not working on your side.

I will forward your reply to our developers, to see if they can debug this any further and suggest a different fix.

Thanks,
Drazen

June 8, 2020 at 5:32 pm #6323913

Dan

Hi Drazen,

I have been able to find a work around to fix this with a small plugin, see below.

object cache is flushed as soon as I am on a translation management page.
Not the most elegant but at least it works.
Would be nice if wpml could solve that for everyone. That Redis object caching plugin seems to be widely used.
Let me know, thanks!
Henri

/*
Plugin Name: ISOC Redis Object Cache Custom
Plugin URI: hidden link
Description: To trigger a custom cache flush when bein in wp-admin/admin.php?page=wpml-translation-management%2Fmenu%2Fmain.php&sm=dashboard
*/

function isoc_flush_cache_wpml() {
if (! defined('WP_REDIS_DISABLED') || ! WP_REDIS_DISABLED) :
$page = '';
if(isset($_GET['page'])) {
$page = $_GET['page'];
}
if($page == 'wpml-translation-management/menu/main.php') {

global $wp_object_cache;
$delay = 0;
return $wp_object_cache->flush($delay);
}

endif;
}

if (is_admin() ) {
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
add_action( 'admin_init', 'isoc_flush_cache_wpml');
}
}

June 8, 2020 at 6:37 pm #6324143

Dan

Hi again,
I found more details about the issue.
When being in the translation basket at wp-admin/admin.php?page=wpml-translation-management%2Fmenu%2Fmain.php&sm=dashboard, this warning popped up:

Warning: A non-numeric value encountered in /var/www/vhosts/dev3.internetsociety.org/wp-content/plugins/wpml-translation-management/inc/translation-proxy/translationproxy-basket.class.php on line 133

And this leads finally to translationproxy-basket.class.php
then get_basket_items_type_count()

Obviously, there is a variable that cannot be counted that should not be considered in such a case.

Best,
Henri

June 9, 2020 at 6:42 am #6327277

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for sharing.

1) Would be nice if wpml could solve that for everyone. That Redis object caching plugin seems to be widely used.

We agree we are looking into a new way how to implement a permanent fix in our plugins, so these issues don't happen anymore.

2) Obviously, there is a variable that cannot be counted that should not be considered in such a case.

It is a source of the issue, Redis converts these pages/jobs to object, then when WPML tries to send and read them it can't since it is an object (not excepted) and gives back an error.

That is why we are looking into a way to have these things ignored from caching, they shouldn't be cached in order to work correctly with WPML.

I am sharing your information with our developers, thanks for getting back.

I will update you soon.

Thanks,
Drazen

June 18, 2020 at 12:10 pm #6403317

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I bring good news, our developers were able to isolate and fix the issue.

A permanent fix will be most probably included in WPML 4.3.16 version.

I will be updating you once the version is available for public download.

Thank you for your collaboration and patient.

Regards,
Drazen

June 18, 2020 at 12:13 pm #6403331

Dan

Hi Drazen,

Good to hear!

I will watch out for the next version.

Thanks very much for your great support!

Henri