Introduction
When too many concurrent threads are in use and the limit is reached, the following out-of-memory log can be thrown:
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reachedWhen this happens, the application will not be able to create additional threads to handle new incoming requests, resulting in a loss of functionality.
Environment
Applications hosted in Mendix Cloud
Cause
This error can occur when an application has exhausted the limit of native threads allowed by the operating system. Analysis of Java Virtual Machine (JVM) metrics may show that the total number of threads has been steadily increasing. For example, this can indicate that a custom Java action in the application is not properly closing native threads, causing thread leakage over time until the system limit is reached.

Solution / Workaround
Restarting the application temporarily resolves the issue by resetting the thread count. However, to prevent recurrence, investigate custom Java actions to ensure threads are correctly closed.
- Monitor the JVM metrics (specifically Total number of threads in the JVM process), to identify if the thread count increases continuously without releasing.
- Review custom Java actions for thread-handling logic. Ensure that every thread created is explicitly closed or terminated after use. If the issue is confirmed in custom code, refactor the implementation to avoid leaving threads open.
Note that Mendix Support cannot assist with troubleshooting Java Actions. This is outside of our scope, as outlined in our documentation: What We Expect from You.
Internal information related
- 250979
- C3T260XGA/p1749036575086689
0 Comments