Our customer is testing this module and noticed error messages like these:
Smartling\Exceptions\SmartlingApiException: Async operation is not completed after 16 seconds.
Our investigation led us to the ContextUploader, the uploadAndMatchContext method in specific.
What could be causing these time-outs? Is there any way to prevent them aside from increasing the default time-out of 15 seconds?
Comments
Comment #2
loparev commentedHi bceyssens,
this happens inside Smartling's api-sdk-php lib on upload and match context sync call. What it means is that smartling context api processes context asynchronously and we poll async process 15 seconds and if it's not completed just throw an exception there.
But in your case I do see a lot of `Async operation is not completed after 15s seconds.` log records (from `94e2dcf74` smartling project) but I don't see appropriate HTTP requests to context API for polling async processes. For example, for `2024-06-26 08:08:43.820 - 2024-06-26 08:12:03.370` I see 7 such errors from `reynaers-acc` host but I see no `/context-api/v2/projects/94e2dcf74/processes/...` HTTP requests for that period of time. Could you please confirm you see those requests from your side? Are those requests blocked?
Comment #3
bceyssens@loparev,
We still run into these issues today. Correct responses are received, with content like this:
Until it switches to state COMPLETED, so the functionality works as designed but it sometimes just takes to long. We tried increasing the time-out to 30 seconds, but it still happens to often. I'll try to capture some of the problematic process ID if you can use those the check logs or something?
Is it really necessary to wait for the matching to complete processing? Edit: If I read the code correctly the response is only used to log a message? I assume it's enough to wait for the upload to complete and continue on Drupal's side?
From time to time queue items are building up rapidly because a lot of translations are being requested (campaign season for our client). We already disabled cron processing to not disturb other processes. See https://www.drupal.org/project/tmgmt_smartling/issues/3545995
Comment #4
loparev commentedHi,
There are 2 upload context calls (with different parameters) that must be done one after another sequentially in
ContextUploader::uploadContextBody():This is the main reason I believe.
I understand. Yes, processing these queues separately (not by drupal default's cron) is probably the best solution for you for now.
Comment #5
bceyssens@loparev,
We've read the code and understand that this is the flow that needs to be followed, but what's the benefit of waiting on the Smartling matching process to finish? In our case we already increased the timeout to 30 seconds, and even then it's sometimes not enough.
Is there other functionality depending on these processes to finish correctly? Or is it only a log that needs to happen on Drupal side?
Comment #6
bceyssensTo prevent locking the process: isn't it possible to do the upload, capture the processUuid from
contexts/upload-and-match-asyncand put that in another queue so we can useDelayedRequeueExceptionto "wait" for the process to finish?Comment #7
loparev commented> but what's the benefit of waiting on the Smartling matching process to finish?
I already answered, there is api call that must be called when previous async operation is done. Seems like me or you are talking about different things.
> isn't it possible to do the upload, capture the processUuid from contexts/upload-and-match-async and put that in another queue so we can use DelayedRequeueException to "wait" for the process to finish?
Sounds like this will cause exactly the same behaviour - you will still get flooded queue (since you have a lot of translation requests going on), it will be just different queue and you will still have other queue processes interruption.
I would need to take a look how to split/enhance the process.
Comment #8
bceyssensThe only thing I want to prevent are timeouts and errors in our logs. These are caused by
uploadAndMatchContextSyncbecause it uses thewaitmethod to check status of the (slow?) matching process on Smartling side.That's why I would split the functionality up in 2 steps/queues but keep all existing logic, that way we give Smartling the time it needs to finish processing without failing on our side:
uploadAndMatchContext, retrieve theprocessUidand create a new item in a separate queueDelayedRequeueExceptioninstead of waiting in the PHP process itselfuploadAndMatchContextagain and log messagesuploadContextMissingResourcesThe major difference it that the waiting part is not done in PHP but in a queue with the correct exceptions, that won't block the queue. Processing of other queue items will continue while waiting for slow ones.
Part of my comment here https://www.drupal.org/project/tmgmt_smartling/issues/3546398 is related to this topic as well:
Comment #9
loparev commentedThese errors now are logged as warnings thanks to @j_bekaert
Comment #10
loparev commentedUpdated context upload logic (removed "redundant" call): https://git.drupalcode.org/project/tmgmt_smartling/-/merge_requests/41. Now context resources uploading will be handled in a separate ticket.