超时时间已过。所有池连接都在使用中并且达到最大池大小

发布于 2024-12-09 01:36:32 字数 2075 浏览 0 评论 0原文

一段时间后,将显示以下错误页面。

我可以做什么来防止这种情况发生?

我有大量用户,并且该应用程序使用 Oracle 11g。请建议我池大小,以便可以扩展默认最大池大小为 100。

我已检查所有连接是否已正确关闭。我在我的应用程序中使用 OracleDataReaderDatatable 我使用的方法如下:

 public OracleDataReader BidNoIncr()
    {
        OracleConnection objOracleConnection = new OracleConnection(objDBClass.GetConnSring());
        OracleDataReader objDataReader;
        string strQuery = "Select max(BID_NO)+1 as SNumber from HH_BIDS";
        OracleCommand objOracleCommand = new OracleCommand(strQuery, objOracleConnection);
           objOracleConnection.Open();
           objDataReader = objOracleCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);       
            return objDataReader;

超时已过。获取之前已过了超时时间 来自池的连接。发生这种情况的原因可能是所有 连接正在使用中并且已达到最大池大小。描述: 当前执行期间发生未处理的异常 网络请求。请查看堆栈跟踪以获取有关的更多信息 错误及其在代码中的起源。

异常详细信息:System.InvalidOperationException:超时已过期。 从获取连接之前已过了超时时间 水池。发生这种情况可能是因为所有池连接都在 使用并达到最大池大小。

源错误:在执行期间生成了未处理的异常 执行当前的网络请求。有关原产地的信息 并且可以使用异常来识别异常的位置 下面的堆栈跟踪。

堆栈跟踪:

[InvalidOperationException:超时已过期。超时时间 从池中获取连接之前已过去。这可能有 发生的原因是所有池连接都在使用且最大池大小 已达到。]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection 拥有连接)+309609
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection 外部连接、DbConnectionFactory 连接工厂)+125
System.Data.OracleClient.OracleConnection.Open() +43
DbClass.GetConnSring() +58 DBViewRec.ViewSalvageItems() +53
viewsalvageitems.ShowRecords() +44
viewsalvageitems.Page_Load(对象发送者, EventArgs e) +5
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,对象 o、对象 t、EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(对象发送者, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(布尔值 includeStagesBeforeAsyncPoint、布尔值 includeStagesAfterAsyncPoint) +2207

After some time the following error page is shown.

What can I do to prevent this?

I have large numbers of users and the app uses Oracle 11g. Please suggest me pool size so can be extended default max pool size is 100.

I have checked all connections properly closed. I am using OracleDataReader and Datatable in my application Method that i am using is as under:

 public OracleDataReader BidNoIncr()
    {
        OracleConnection objOracleConnection = new OracleConnection(objDBClass.GetConnSring());
        OracleDataReader objDataReader;
        string strQuery = "Select max(BID_NO)+1 as SNumber from HH_BIDS";
        OracleCommand objOracleCommand = new OracleCommand(strQuery, objOracleConnection);
           objOracleConnection.Open();
           objDataReader = objOracleCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);       
            return objDataReader;

Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached. Description:
An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Timeout expired.
The timeout period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled connections were in
use and max pool size was reached.

Source Error: An unhandled exception was generated during the
execution of the current web request. Information regarding the origin
and location of the exception can be identified using the exception
stack trace below.

Stack Trace:

[InvalidOperationException: Timeout expired. The timeout period
elapsed prior to obtaining a connection from the pool. This may have
occurred because all pooled connections were in use and max pool size
was reached.]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) +309609
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +125
System.Data.OracleClient.OracleConnection.Open() +43
DbClass.GetConnSring() +58 DBViewRec.ViewSalvageItems() +53
viewsalvageitems.ShowRecords() +44
viewsalvageitems.Page_Load(Object sender, EventArgs e) +5
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2207

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

镜花水月 2024-12-16 01:36:32

一般来说,此错误可能在以下情况下发生:

1) 您有大量用户同时使用您的数据库,并且您用完了可用连接。可能的解决方案:增加服务器上允许的连接数和/或(如果您的系统是网络服务器)增加数据库连接字符串中指定的池大小。

2)您的系统的数据库逻辑设计不佳和/或连接泄漏,例如打开的连接稍后未正确关闭。解决方案是审核您的代码是否存在此类连接泄漏,并通过始终正确关闭连接来修复它们。

In general, this error may occur in the following situations:

1) You have a very large number of users using your database in the same time and you run out of free connections. Possible solutions: increase number of allowed connections on your server and/or (if your system is a webserver) increase the pool size specified in database connection string.

2) Your system has poor database logic design and/or connection leaks like when connection open isn't closed properly later. Solution for this will be auditing your code for such connection leaks and fixing them by properly closing connections all the time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文