Hello,
I have been using Stimulsoft with ASP.NET MVC for some time and have observed a critical issue related to database connections.
(.Net 8 and Stimulsoft.Reports.Web.NetCore 2025.1.5)
When the RequestParameters property of a report is set to false, everything functions as expected. The database connection enters an idle state and is eventually released according to the Connection Idle Lifetime value defined in the connection string.
However, when RequestParameters is set to true, Stimulsoft does not release the database connection—even after the idle timeout period has passed. Upon inspecting active connections via pg_stat_activity in PostgreSQL, I noticed that these connections remain in an idle state indefinitely. Furthermore, each time the user refreshes the report (e.g., by refreshing the iframe), a new connection is opened, and none of the previous ones are closed.
Summary of Observations:
• When RequestParameters = false:
• Connection state is set to idle and is eligible for reuse.
• After the configured idle timeout, the connection is properly closed and removed from the pool.
• When RequestParameters = true:
• Connection state remains idle, but it is never released.
• These connections accumulate over time and cannot be reused.
This behavior causes the connection pool to fill up rapidly. For example, if a user refreshes the page 100 times (assuming a default maximum pool size of 100), the pool limit is reached, and no further reports can be executed.
I would appreciate any guidance or solutions to ensure connections are properly released when using RequestParameters = true.
Note: I fixed this issue with workaround but its a bug.
Stimulsoft Connection Leak Issue
-
- Posts: 7424
- Joined: Tue Mar 20, 2018 5:34 am
Re: Stimulsoft Connection Leak Issue
Hello,
We require some time to investigate the issue thoroughly. Rest assured, we will keep you informed about the outcome as soon as possible.
Thank you.
#18120
We require some time to investigate the issue thoroughly. Rest assured, we will keep you informed about the outcome as soon as possible.
Thank you.
#18120
-
- Posts: 1
- Joined: Wed Sep 10, 2025 4:38 am
Re: Stimulsoft Connection Leak Issue
Hello Lech,
We also encountering the same case and same summary of observations with ruen's post, and we found the new observation.
When we remove the Customize "StiCacheHelper" class in my project, the DB connection leakage from variable enabled "Request from User" (with drop down list data from DB) is no longer happened, but we need this custom "StiCacheHelper" due to our project is require to work in high availability + active-active + load balance by setup multi report service instance in multiple server node, which require a centralized data store to cache the rendered report.
We suspect the cause of the issue may be due to the implementation of LoadPackedReport() method from StiReport object, hope this can help to quicken identify the root cause and resolution for the DB connection leakage issue.
Hello ruen,
Would you mind to share the workaround about temporary fix this bug?
Thank you.
We also encountering the same case and same summary of observations with ruen's post, and we found the new observation.
When we remove the Customize "StiCacheHelper" class in my project, the DB connection leakage from variable enabled "Request from User" (with drop down list data from DB) is no longer happened, but we need this custom "StiCacheHelper" due to our project is require to work in high availability + active-active + load balance by setup multi report service instance in multiple server node, which require a centralized data store to cache the rendered report.
We suspect the cause of the issue may be due to the implementation of LoadPackedReport() method from StiReport object, hope this can help to quicken identify the root cause and resolution for the DB connection leakage issue.
Hello ruen,
Would you mind to share the workaround about temporary fix this bug?
Thank you.
-
- Posts: 7424
- Joined: Tue Mar 20, 2018 5:34 am
Re: Stimulsoft Connection Leak Issue
Hello,
Thank you for the additional information about the StiCacheHelper.
Thank you.
Thank you for the additional information about the StiCacheHelper.
Thank you.
Re: Stimulsoft Connection Leak Issue
Hi,chingliang.lim wrote: ↑Wed Sep 10, 2025 5:45 am Hello Lech,
We also encountering the same case and same summary of observations with ruen's post, and we found the new observation.
When we remove the Customize "StiCacheHelper" class in my project, the DB connection leakage from variable enabled "Request from User" (with drop down list data from DB) is no longer happened, but we need this custom "StiCacheHelper" due to our project is require to work in high availability + active-active + load balance by setup multi report service instance in multiple server node, which require a centralized data store to cache the rendered report.
We suspect the cause of the issue may be due to the implementation of LoadPackedReport() method from StiReport object, hope this can help to quicken identify the root cause and resolution for the DB connection leakage issue.
Hello ruen,
Would you mind to share the workaround about temporary fix this bug?
Thank you.
I'm manually closing the db connection in http post viewer event end point before returning the response.
Code: Select all
var res = StiNetCoreViewer.ViewerEventResult(this);
var report = StiNetCoreViewer.GetReportObject(StiNetCoreViewer.GetRequestParams(this));
if (report.RequestParameters && report.CompiledReport != null && report.CompiledReport.DataStore.Count > 0)
{
((DbConnection)report.CompiledReport.DataStore[0].ViewData).CloseAsync();
}
return res;