调试超时有哪些好方法? (C#)

发布于 2024-08-04 17:02:49 字数 541 浏览 2 评论 0原文

我正在构建一个可以正常运行几个小时的网站,但随后 *.asmx 和 *.ashx 调用开始超时。

例外情况是:“超时已过期。从池中获取连接之前超时时间已过。这可能是因为所有池连接都在使用中并且已达到最大池大小而发生。”

我使用 SubSonic 作为 ORM。

我怀疑问题是基于每隔几分钟运行一次并访问数据库的计划任务。当我查看 SQL Server 2000 的“当前活动”时,我看到有:

  • 100 个处于“睡眠”状态的进程
  • 100 个锁

这 100 个进程来自应用程序“.Net SqlClient Data Provider”,命令是“AWAITING COMMAND”。

所以我猜这就是问题所在。 。但我该如何排除故障呢?这听起来像是数据库中的死锁情况吗?一旦我

c:\> iis重新启动

,一切都很好(暂时)。

谢谢 - 我只是从未遇到过这样的事情,并且不确定继续进行的最佳方法。

迈克尔

I'm building a site that runs fine for a few hours, but then *.asmx and *.ashx calls start timing out.

The exception is: "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."

I'm using SubSonic as the ORM.

I suspect that the problem is based on a scheduled task that runs every few minutes and hits the database. When I look in SQL Server 2000's "Current Activity", I see there are:

  • 100 processes with the status "sleeping"
  • 100 locks

The 100 processes are from the Application ".Net SqlClient Data Provider" and the command is "AWAITING COMMAND".

So I'm guessing that's the issue . . but how do I troubleshoot it? Does this sound like a deadlock condition in the db? As soon as I

c:\> iisrestart

, everything's fine (for a while).

Thanks - I've just never encountered something like this and am not sure the best way to proceed.

Michael

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

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

发布评论

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

评论(3

烟花易冷人易散 2024-08-11 17:02:50

这可能是这个问题的重复 - 连接池在 Subsonic 中是否正常工作?< /a>

如果您使用 Load() 而不是 LoadAndCloseReader() 加载对象,则每个连接都将保持打开状态,最终您将耗尽连接池。

It could be a duplicate of this problem - Is connection pooling working correctly in Subsonic?

If you're loading objects with Load() instead of LoadAndCloseReader(), each connection will be left open and eventually you'll exhaust the connection pool.

笑忘罢 2024-08-11 17:02:50

当您在集合上调用 Load() 时,它将使 Reader 保持打开状态 - 如果您希望 Reader 关闭,请确保调用 LoadAndCloseReader() - 或使用 using 块。

拥有一些源代码也很有帮助。

When you call Load() on a collection it will leave the Reader open - make sure you call LoadAndCloseReader() if you want the reader to close off - or use a using block.

It helps to have some source code as well.

昇り龍 2024-08-11 17:02:50

我对 Subsonic 一无所知,但也许你正在泄露数据库“上下文”?我会检查您完成后是否正在处置任何数据库资源......

I don't know anything about Subsonic, but maybe you are leaking database 'contexts'? I'd check that any database resource is being disposed after you're finished with it...

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