Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

At the platform level, Joget Workflow has been tested to ensure that there are no leaks in memory or database connections and other resources. However, for custom scripts and plugins, etc, developers will need to ensure that database connections and other resources are properly released after being used (i.e. using a try-catch-finally block). Improper management of resources will lead to eventual exhaustion of resources, causing the system to become unresponsive or appear to hang.

Platform Datasource Monitoring

In v6, a new feature incorporated into the 性能分析器 now provides monitoring of database connections at runtime, with warnings of possible database connection leaks.

When logged in as an administrator, the Performance Analyzer displays the number of active and idle platform datasource connections at the top left corner of the app userview.

Image Removed

In a stable environment, the number of active and idle connections will increase when load increases, and reduce accordingly once connections are released. When connections are not being released properly the number of connections will keep increasing without reducing, which would give an indication of possible connection leaks.

 

Connection Leak Detection in Custom JDBC Code

在平台级别上,Joget Workflow已经过测试,以确保内存或数据库连接和其他资源没有泄漏。但是,对于自定义脚本和插件等,开发人员需要确保数据库连接和其他资源在使用后(即使用try-catch-finally块)被正确释放。资源管理不当将最终导致资源枯竭,导致系统无响应或挂起。

平台数据源监视

在第6版中,  性能分析器 的一项新功能现在提供了在运行时监视数据库连接,并警告可能的数据库连接泄漏。

当以管理员身份登录时,性能分析器会在应用程序用户视图的左上角显示活动和闲置平台数据源连接的数量。

Image Added

在一个稳定的环境中,当负载增加时,活动连接和空闲连接的数量将增加,并且一旦释放连接,连接的数量就会相应减少 当连接没有被正确释放时,连接的数量将会不断增加而不会减少,这将显示可能的连接泄漏。

 

自定义JDBC代码中的连接泄漏检测

这个连接监视跟踪平台数据源。但是,也有很多情况下,BeanShell脚本或自定义插件中的自定义JDBC代码不使用平台数据源,并使用自己的JDBC连接。为了解决这个,有一个警告机制,检查可能导致泄漏的潜在的未关闭的JDBC连接。此检测适用于BeanShell和自定义插件代码。当检测到可能的泄漏时,将在平台日志文件中捕获警告,例如,This connection monitoring keeps track of the platform datasource. However, there are also many cases where custom JDBC code in BeanShell scripts or custom plugins do not use the platform datasource, and utilize their own JDBC connections. To cater for this, there is a warning mechanism that checks for potential unclosed JDBC connections that may cause leaks. This detection works for both BeanShell and custom plugin code. When a possible leak is detected, a warning will be captured in the platform log file, e.g.

 

Code Block
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 includes the URL path, so this allows administrators to identify the page causing the problem.

警告包含URL路径,因此管理员可以识别导致问题的页面。


Warning

请注意,泄漏检测可能无法100%正常工作,因为自定义代码可能会导致连接泄漏,但它应该有助于检测大多数常见JDBC代码中的问题。

Warning
Please note that the leak detection may not work 100% as there are many variations in which custom code may cause connection leaks, but it should help to detect problems in most common JDBC code.