c# – 使用WinDBG进行Postmortem调试

c# – 使用WinDBG进行Postmortem调试,第1张

概述我有一个在服务器上运行的WCF服务,偶尔(每月1-2次)它会抛出一个带有信息性消息“Unknown error(0x8005008)”的COMException.当我搜索这个特定的错误时,我只在IIS中创建虚拟目录时遇到问题.并且源代码与在IIS中创建虚拟目录没有任何关系. DirectoryServiceLib.LdapProvider.Directory - CreatePost - Coul 我有一个在服务器上运行的WCF服务,偶尔(每月1-2次)它会抛出一个带有信息性消息“UnkNown error(0x8005008)”的COMException.当我搜索这个特定的错误时,我只在IIS中创建虚拟目录时遇到问题.并且源代码与在IIS中创建虚拟目录没有任何关系.

DirectoryServicelib.LdapProvIDer.Directory - CreatePost - Could not create employee for 195001010000,000000000000: System.Runtime.InteropServices.COMException (0x80005008): UnkNown error (0x80005008) at System.DirectoryServices.PropertyValueCollection.PopulateList

当我在WinDBG中捕获Exception以进一步分析时,我已经使用了memorydump.切换到正确的线程后,我执行了!Clrstack命令:

000000001b8ab6d8 000000007708671a [NDirectMethodFrameStandalone: 000000001b8ab6d8] Common.MemoryDump.MinIDumpWriteDump(IntPtr,Int32,IntPtr,MINIDUMP_TYPE,IntPtr)000000001b8ab680 000007ff002808d8 DomainBoundILStubClass.IL_STUB_PInvoke(IntPtr,IntPtr)000000001b8ab780 000007ff00280812 Common.MemoryDump.CreateMinIDump(System.String)000000001b8ab7e0 000007ff0027b218 DirectoryServicelib.LdapProvIDer.Directory.CreatePost(System.String,DirectoryServicelib.Model.Post,DirectoryServicelib.Model.Presumptions,Services.Common.sourceEnum,System.String)000000001b8ad6d8 000007fef8816869 [HelperMethodFrame: 000000001b8ad6d8] 000000001b8ad820 000007feec2b6c6f System.DirectoryServices.PropertyValueCollection.PopulateList()000000001b8ad860 000007feec225f0f System.DirectoryServices.PropertyValueCollection..ctor(System.DirectoryServices.DirectoryEntry,System.String)000000001b8ad8a0 000007feec22d023 System.DirectoryServices.PropertyCollection.get_Item(System.String)000000001b8ad8f0 000007ff00274d34 Common.DirectoryEntryExtension.GetStringAttribute(System.String)000000001b8ad940 000007ff0027f507 DirectoryServicelib.LdapProvIDer.DirectoryPost.copy(DirectoryServicelib.LdapProvIDer.DirectoryPost)000000001b8ad980 000007ff0027a7cf DirectoryServicelib.LdapProvIDer.Directory.CreatePost(System.String,System.String)000000001b8adbe0 000007ff00279532 DirectoryServicelib.WCFDirectory.CreatePost(System.String,System.String)000000001b8adc60 000007ff001f47bd Dynamicclass.SyncInvokeCreatePost(System.Object,System.Object[],System.Object[])

我的结论是它在代码调用时失败了
System.DirectoryServices.PropertyCollection.get_Item(System.String).

所以在发出!Clrstack -a之后我得到了这个结果:

000000001b8ad8a0 000007feec22d023 System.DirectoryServices.PropertyCollection.get_Item(System.String)   ParaMETERS:      this = <no data>      propertyname = <no data>   LOCALS:      <CLR reg> = 0x0000000001dcef78      <no data>

我的第一个问题是为什么它没有显示属性名称的数据?我在Windbg上有点新鲜.但是我在= 0x0000000001dcef78上执行了一个dumpobject:

0:013> !do 0x0000000001dcef78name:        System.StringMethodtable: 000007fef66d6960EEClass:     000007fef625eec8Size:        74(0x4a) bytesfile:        C:\windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dllString:      personalprescriptioncodeFIElds:                  MT    FIEld   Offset                 Type VT     Attr            Value name000007fef66dc848  40000ed        8         system.int32  1 instance               24 m_stringLength000007fef66db388  40000ee        c          System.Char  1 instance               70 m_firstChar000007fef66d6960  40000ef       10        System.String  0   shared           static Empty                                 >> Domain:Value  0000000000174e10:00000000019d1420 000000001a886f50:00000000019d1420 <<

因此,当源代码想要从Active Directory(用于持久层的内容)中获取个人订阅代码时,它就会失败.回顾堆栈时发出copy方法.
DirectoryServicelib.LdapProvIDer.DirectoryPost.copy(DirectoryServicelib.LdapProvIDer.DirectoryPost)

所以查看源代码:

DirectoryPost postInlimbo = DirectoryPostFactory.Instance().GetDirectoryPost(LdapConfigReader.Instance().GetConfigValue("limboDN"),IDGenPerson.ID.UserID);if (postInlimbo != null)   newPost.copy(postInlimbo);

此代码在OU = limbo中查找具有相同UserID的另一个帖子,如果找到一个,则将属性复制到新帖子.在这种情况下确实如此,并且它与个人订阅代码失败.我在OU = limbo下查看了Active Directory,帖子中存在属性personalprescriptioncode = 31243.

问题1:为什么它没有显示某些ParaMETERS和LOCALS的数据?是否在创建memorydump之前清理了GC.

问题2:我能做些什么才能解决这个问题?

解决方法
//// MessageID: E_ADS_BAD_ParaMETER//// MessageText:////  One or more input parameters are invalID//#define E_ADS_BAD_ParaMETER              _HRESulT_TYPEDEF_(0x80005008L)

您无法查看参数/局部变量值,因为代码已经过优化.它们在调用时存储在cpu寄存器中,而不是堆栈帧.你再也找不到大海捞针了.

总结

以上是内存溢出为你收集整理的c# – 使用WinDBG进行Postmortem调试全部内容,希望文章能够帮你解决c# – 使用WinDBG进行Postmortem调试所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1227754.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存