I am having trouble avoiding these errors when trying to retrieve large numbers (tens of thousands) of objects for input to a microflow or Java action, for example if I want to write out the objects shown in a datagrid (with whatever filters may be currently applied to it) to a file. The same thing happens if I try to "Export to Excel": Cannot get a connection, pool error Timeout waiting for idle object Per previous questions I was advised to raise the ConnectionPoolingMaxActive threshold in application.conf. If I increase this to say 5,000 I get "failed to initialise new thread" errors, presumably because the capacity for new connections has run out. I can't understand why I can't work with large lists of objects passed from the context to a microflow or onward to Java. How many connections do I need in the pool for a given number of objects, and are there other ways of influencing this?
The number of database connections that Mendix tries to use is indeed configurable using the connection pooling settings. However, it is important that these settings somewhat correspond with the settings of the DBMS you are using.
In your case I think the number of connections allowed by your database is not high enough for the operations Mendix is trying to perform. In PostgreSQL you can alter the maximum number of allowed connections by increasing max_connections in postgresql.conf. By default this is set to 100, which in my experience is a bit to low for most Mendix applications. I usually set this to 512. If you increase this number, you might also want to increase the shared_buffers, because these settings are somewhat related.
Other database systems should have similar settings.