不寻常的异常 - 读取/更新 Excel 电子表格

发布于 2024-08-23 22:29:50 字数 529 浏览 3 评论 0原文

我正在将完整电子表格的内容读取到数据表

然后迭代 Table.Rows 查询远程数据库 (Oracle),并创建/更新/删除 ADS 帐户

然后使用结果(状态)更新 Excel 行

大多数情况下一切正常顺利地,但间歇性地我得到这个例外:

检测到 ContextSwitchDeadlock
消息: CLR 在 60 秒内无法从 COM 上下文 0x2119a8 转换到 COM 上下文 0x211b18。拥有目标上下文/单元的线程很可能执行非泵送等待或处理非常长时间运行的操作而不泵送 Windows 消息。

这种情况通常会对性能产生负面影响,甚至可能导致应用程序变得无响应或内存使用量随着时间的推移不断累积。为了避免此问题,所有单线程单元 (STA) 线程都应使用泵送等待原语(例如 CoWaitForMultipleHandles),并在长时间运行的操作期间定期泵送消息。

可能是什么原因造成的?

I am reading content of a full spread sheet to a datatable

Then iterate through Table.Rows Query Remote database (Oracle), and Create/Update/Delete ADS account

Then update the Excel row with the result (status)

Most of the time things go smoothly, but intermittently I get this exception:

ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x2119a8 to COM context 0x211b18 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages.

This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

What could be causing this ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文