The error typically occurs when the Mendix runtime tries to retrieve a task from the queue but encounters a database connection issue. Specifically, the connection may have been closed or become invalid while still being part of an active transaction. This can happen due to:
Recommended Fixes
Upgrade Mendix Runtime and Queue ModuleIf you're using an older version of Mendix or the deprecated Queue module, upgrade to the latest Mendix version and use the built-in Task Queue feature introduced in Mendix 9.0.3
Check Database Connection Pool SettingsEnsure your database connection pool is sized appropriately for the number of concurrent tasks. You may need to increase the pool size or reduce the number of parallel tasks.
Avoid Long-Running Transactions in Queued MicroflowsReview the microflows executed by the task queue. Avoid long-running operations or nested loops that hold database connections for extended periods.
Use Commit and EndTransaction WiselyMake sure that each queued task commits its changes and ends the transaction properly. Uncommitted changes or open transactions can cause connection issues.
Enable Connection ValidationIn your database configuration, enable connection validation (e.g., validationQuery in JDBC) to ensure connections are alive before use.
Monitor Logs and Database HealthUse Mendix logs and your database monitoring tools to track connection usage, timeouts, and errors. This can help pinpoint the exact cause.
If this issue persists across multiple queues, it may indicate a systemic problem with how tasks are managed or how the database is configured.