调用DLL时,.NET应用程序挂起 [英] .NET Application hangs when calling DLL

查看:72
本文介绍了调用DLL时,.NET应用程序挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

上周我的代码遇到了一个奇怪的问题。它已经在生产中运行了一年多,这是我第一次看到这种行为。该应用程序是一个由MQ服务器触发的VB.NET控制台应用程序。此应用程序使用类
库,它是同一项目的一部分(Say'abc.dll')。在生产中,这个exe的40多个实例正在运行,并且所有这些实例都使用了'abc.dll'中的一些函数。

I ran into a wierd issue with our code last week. Its been running in production for over a year and this is the first time I saw this behaviour. The application is a VB.NET Console Application which is triggered by MQ server. This application uses a class library which is part of the same project(Say 'abc.dll'). In production around 40+ instances of this exe are running and all of them use the some of the functions from 'abc.dll'.

上周,我们注意到所有40个实例都是显示在任务管理器中运行,但他们没有进行任何活动。应用程序日志或系统日志中没有抛出异常或记录错误。为了疯狂地调试问题,我尝试了
隔离问题。

Last week, we noticed that all the 40 instances were shown to be running in the task manager but they were not doing any activity. There was no exception thrown or error logged in Application logs or System logs. To frantically debug the problem, I tried isolating the problem.

所有这些40多个exes都挂了,我写了一个小的应用程序,它会使用这个'a'的引用.dll',在该dll中创建一个类的对象并在那里执行一个方法。我在两者之间打印console.writelines以查看在出错之前它到达了哪个点

With all these 40+ exes hung up, I wrote a small aplication which would use a reference to this 'a.dll', create an object of one of the classes in that dll and execute a method in there. I was printing console.writelines in between to see to which point it gets to before erroring out.

令我惊讶的是,我发现在我创建的时候'a.dll'中类的对象,此示例测试应用程序也会像其他应用程序一样挂起。没有例外。所以我作为最后的手段杀了所有这些应用程序,然后当我重新启动
所有这些应用程序时,一切正常。

To my surprise, I found that at the point where I was creating an object of a class in 'a.dll' this sample test application would also hang just like the others. No exceptions thrown. So I killed all those applications as a last resort and then when I restarted all of them, everything worked fine.

我找不到任何有关此行为的解释。由于这是一个影响生产系统的严重错误(将应用程序清空3个小时以上),我必须给出一个很好的解释,为什么会发生这种情况。你们这些优秀的绅士可以提供
的建议,说明为什么会发生/将来如何防止这种情况。

I couldn't find any explanation for this behaviour. Since it was a critical error affecting a production system(blanking out the application for 3+ hours), I have to give a very good explanation as to why this would occur. Can any of you fine gentleman give suggestions as to why it happened/how it can be prevented in future.

(旁注:运行这些应用程序的服务器没有维护计划,并且应该一起运行几个月。想知道是否有什么东西随着时间的推移而腐败。想法?)

(Side note: the servers running these appilcation do not have a maintenance schedule and are supposed to be up for couple of months together. Wonder if something got corrupted over time. Thoughts?)

推荐答案

它可能与SystemTime翻转有关吗?
Any chance it might be related to SystemTime rollover?


这篇关于调用DLL时,.NET应用程序挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆