追踪缓慢的托管 DLL 加载

发布于 2024-08-05 01:34:26 字数 597 浏览 2 评论 0原文

我面临以下问题,此时我觉得我严重缺乏某种工具,我只是不知道该工具是什么,或者它到底应该做什么。

这是设置: 我有一个必须在 GAC 中注册的第 3 方 DLL。这一切在我们之前部署过软件的几乎每台机器上都运行得很好。但现在我们有了两台机器,看起来与我们知道的工作的机器相同(它们是从同一个映像克隆的,并填充了相同的硬件,所以几乎唯一的区别是软件设置,我一遍又一遍地检查它们,它们看起来不错)。

现在的问题是,GAC 中的 DLL 需要很长时间才能加载。至少我相信这就是问题所在,我可以明确地说,从该 DLL 实例化单个类是缓慢的部分。一旦装载,东西就会像往常一样飞起来。但是,虽然在已知良好的计算机上,DLL 加载速度如此之快,以至于日志中的时间戳甚至没有改变,但在这两台计算机上,加载时间超过 1 分钟

已知: 我无法访问源代码,因此无法通过 DLL 进行调试。我们的应用程序是唯一使用它的应用程序(因此不应该是同时访问问题)。该 DLL 仅存在一个版本,因此不应该是版本冲突的问题。正在使用 GAC 引用(如果我从 GAC 卸载 DLL,则会引发有关缺少 GAC 引用的异常)。

在 debug-fu 方面具有更高技能的人是否可以建议我可以采取哪些措施来追踪此问题的根本原因?

I am faced with the following issue and at this point I feel like I'm severely lacking some sort of tool, I just don't know what that tool is, or what exactly it should be doing.

Here is the setup:
I have a 3rd party DLL that has to be registered in GAC. This all works fine and good on pretty much every machine our software was deployed on before. But now we got 2 machines, seemingly identical to the ones we know work (they are cloned from the same image and stuffed with the same hardware, so pretty much the only difference is software settings, over which I went over and over, and they seem fine).

Now the problem, the DLL in GAC takes a very long time to load. At least I believe this is the issue, what I can say definitively is that instantiating a single class from that DLL is the slow part. Once it is loaded, thing fly as they always have. But while on known-good machines the DLL loads so fast that a timestamp in the log doesn't even change, on these 2 machines it take over 1min to load.

Knowns:
I have no access to the source, so I can't debug through the DLL. Our app is the only one that uses it (so shouldn't be simultaneous access issues). There is only one version of this DLL in existance, so it shouldn't be a matter of version conflict. The GAC reference is being used (if I uninstall the DLL from GAC, an exception will be thrown about the missing GAC reference).

Could someone with a greater skill in debug-fu suggest what I can do to track down the root cause of this issue?

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

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

发布评论

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

评论(2

音盲 2024-08-12 01:34:26

下载 2 个名为“filemon.exe”和“regmon.exe”的小实用程序,它们会向您显示有关打开文件和打开文件的情况。分别注册表。每当我无法确定程序是挂起还是正在加载时,这些工具都可以让我深入了解它们正在做什么或正在等待什么。

download 2 small utilities called : 'filemon.exe' and 'regmon.exe' they show you whats going on concerning opening files & registry respectively. Whenever I can't decide if a program hangs or is just loading, these tools give me insight in what they are doing, or what they are waiting for.

苄①跕圉湢 2024-08-12 01:34:26

我认为最好的选择是调试应用程序。调试应用程序并不严格需要源代码,它只是使调试变得更加容易。这是我将使用的策略

  1. 禁用仅我的代码(工具 - >选项 - >调试器 - >常规)
  2. 在调试器下启动程序
  3. 等待挂起中断
  4. 打开调用堆栈

此时您应该能够看到程序当前在哪里中断。本质上是方法的名称。这将为您提供一些指示,表明加载过程中哪些操作花费了如此多的时间(即使您没有源代码)。

如果该方法不熟悉,请在此处发回数据,希望有人能够帮助您解决问题。

I think your best bet here is to debug into the application. Source is not strictly needed to debug an application, it just makes it a heck of a lot easier. Here is the strategy that I would use

  1. Disable Just My Code (Tools -> Options -> Debugger -> General)
  2. Start the program under the debugger
  3. Wait for the hang
  4. Hit break.
  5. Open up the call stack

At this point you should be able to see where the program is currently broken at. Essentially the name of the method. This will give you some indication of what operation is taking so much time during load (even though you won't have the source).

If the method is unfamiliar post back the data here and hopefully someone will be able to help you out with tracking down the problem.

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