• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

pdfservices Operation Timed Out when generating PDF

New Here ,
Nov 17, 2021 Nov 17, 2021

Copy link to clipboard

Copied

I am calling pdfservices using the pdfservices-sdk-2.1.0.jar and I more often than not receive a timeout. The error received is: 

com.adobe.pdfservices.operation.exception.ServiceApiException: description ='Operation timed out; transactionId=kfvgjemcquOgWIkQZSVgjcjHkyTAg8yL'; requestTrackingId='WDwted6OPYfluBO3fDBwFbhlfNKS4eLY'; statusCode=500; errorCode=REQUEST_TIMEOUT

at com.adobe.pdfservices.operation.pdfops.DocumentMergeOperation.execute(DocumentMergeOperation.java:145) ~[pdfservices-sdk-2.1.0.jar:?]

The error occurs in the CPFApi class, method cpfStatusApi. 

Sometimes the .docx to .pdf conversion works fine, but more frequently it will hit the timeout problem. On initial system start-up, it will frequently convert one document, then if I run the identical job again it will run into the timeout problem. 

The method that it's in when the timeout occurs is (in the CPFApi class):

    public static <T> HttpResponse<T> cpfStatusApi(InternalExecutionContext context,

                                                   String location,

                                                   Class<T> responseType) {

 

        BaseHttpRequest baseHttpRequest = (BaseHttpRequest) context.getBaseRequestFromRequestContext(RequestKey.STATUS);

        baseHttpRequest.withTemplate(location);

 

        HttpClient httpClient = HttpClientFactory.getDefaultHttpClient();

        HttpResponse<T> response =

                httpClient.send(baseHttpRequest, responseType);

 

        // Time bound polling

        long startTimeMs = System.currentTimeMillis();

        int count = 1;

        while (response.getStatusCode() == ACCEPTED_SUCCESS_STATUS_CODE) {

            LOGGER.debug("Polling for status ");

            long retryIntervalMs = (count > 5) ? DELAY_POLLING_INTERVAL : POLLING_INTERVAL;

            if (System.currentTimeMillis() - startTimeMs > TIME_LIMIT_MS) {

                LOGGER.debug("Polling Timeout reached. Something's wrong, file operation took too long");

                throw new OperationException("Operation execution has timed out!",

                        StringUtil.getRequestIdFromLocation(location), POLLING_TIMEOUT_STATUS_CODE);

            } else {

                // Keep polling

                try {

                    TimeUnit.MILLISECONDS.sleep(retryIntervalMs);

                } catch (InterruptedException ex) {

                    throw new SdkException("Thread interrupted while waiting for operation execution status!!", ex);

                }

                response = httpClient.send(baseHttpRequest, responseType);

                count++;

            }

        }

        return response;

    }

Any help would be appreciated.

Thanks,

Alan

TOPICS
Document Generation API , PDF Services API

Views

331

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources