<-- Back

ConnectionPoolTimeoutException while merging PDF files using the Community Commons MergeMultiplePdfs java action in Mendix Cloud

Issue

The application logs show the following timeout error when attempting to merge more than 10 Portable Document Format (PDF) into a single document at once using the Community Commons MergeMultiplePdfs Java action. This timeout exception does not occur while running the application locally.

ERROR - DocGen: Bordereau generation failed at merging documents due to the following:
2025-02-03T00:04:20.897207 [APP/PROC/WEB/0] Type: org.apache.http.conn.ConnectionPoolTimeoutException
2025-02-03T00:04:20.897216 [APP/PROC/WEB/0] Reason: Timeout waiting for connection from pool
2025-02-03T00:04:20.897261 [APP/PROC/WEB/0] Stack: com.mendix.systemwideinterfaces.MendixRuntimeException: com.amazonaws.SdkClientException: Unable to execute HTTP request: Timeout waiting for connection from pool

Environment

Applications hosted in Mendix Cloud

Community Commons (all versions)

Cause

As outlined in our documentation, the Community Commons module has a default restriction, allowing only 10 files to be processed at once for compatibility with Mendix Cloud. If the number of PDF files being merged exceeds the default restriction of 10, a timeout can occur. This happens because each opened file requires a connection to an Amazon Simple Storage Service (S3) bucket. When many files are processed simultaneously, the available connection pool becomes exhausted, preventing new connections from being established and ultimately resulting in a timeout error.

Solution/Workaround

To avoid a timeout error, there are two options:

  • It is recommended to handle the merge of the PDFs in batches of 10.
  • If more than 10 files need to be merged, the default merge limit can be changed. Keep in mind that merging PDFs in batches is still the recommended approach. Additionally, since the application's behavior may vary, it is important to monitor its performance to ensure optimal behavior. To override the value, follow these steps:
      1. In Studio Pro, open the App Explorer and find the Community Commons module under Marketplace Modules.
      2. Navigate to the Constants folder and select MergeMultiplePdfs_MaxAtOnce.
      3. Change the default value as needed. Setting the value to <= 0 means unlimited.
      4. Click Ok and close the window

Internal information related

Additional information 

Mendix documentation: Community Commons

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.