Database Monitoring and Leak Detection

Joget DX is rigorously tested to guarantee no leaks in memory, database connections, or other resources at the platform level. However, developers implementing custom scripts and plugins must take additional precautions to manage resources correctly and ensure all database connections and other resources are properly released after use. This is best achieved using a try-catch-finally block in the code. Failure to adequately manage resources can lead to their exhaustion, causing the system to become unresponsive or appear to hang.

Platform database monitoring

The Performance Analyzer monitors database connections at runtime, with warnings of possible connection leaks. When logged in as an administrator, the Performance Analyzer displays the number of active and idle platform data source connections at the top left corner of the app user view.

In a stable environment, the number of active and idle connections will increase when the load increases and will be reduced accordingly once connections are released. When connections are not being released properly, the number of connections will keep increasing without reducing, indicating possible connection leaks.

Connection leak detection in custom JDBC code

While the platform data source is monitored by default, custom JDBC code in BeanShell scripts or plugins often utilizes separate JDBC connections. To address this, Joget includes a warning mechanism:

  • This system tracks unclosed JDBC connections that could lead to leaks. The detection is effective for both BeanShell and custom plugin code.
  • A warning is logged in the platform log file when a potential leak is detected. For example:
WARN 22 Aug 2016 12:06:10 org.joget.commons.util.Analyzer - Possible unclosed DB connections: 4; URL: /jw/web/userview/dbtest/v/_/form1_crud
  • The warning provides the URL path, aiding administrators in identifying which page is causing the issue.
It's important to note that the leak detection system might not catch every instance, as variations in custom code can lead to leaks in ways that are not always predictable. Nevertheless, this feature is a valuable tool for detecting many common issues with JDBC code.
Created by Marcos Last modified by Aadrian on Dec 13, 2024