Access violation in CLR when trying to release RCW's RRS feed

  • Question

  • Hello,

    I have spent two days scratching my head trying to understand the following call stack...Any input/thoughts would be highly appreciated. Thanks in advance!

    In order to diagnose heap corruption in the process, I enabled "Page heap" for it and attached it with WinDBG. I have been hitting access violation with the following call stack when invoking/instantiating a dialog in the application (it happens every time but the first invoke)

    Looks like CLR is trying to cleanup a non-existent RCW. Any ideas on how can i find what RCW its trying to cleanup so that i can investigate the code in that area further?


    Current frame: clr!SafeReleasePreemp+0x231
    ChildEBP RetAddr  Caller, Callee
    055dfb70 71936f36 clr!CtxEntry::EnterContext+0x3bf, calling clr!_EH_epilog3
    055dfb9c 71935c17 clr!RCW::ReleaseAllInterfaces+0x70, calling clr!SafeReleasePreemp
    055dfbb4 71935cb0 clr!RCW::ReleaseAllInterfacesCallBack+0x60, calling clr!RCW::ReleaseAllInterfaces
    055dfbf0 71935d0c clr!RCW::Cleanup+0x41, calling clr!RCW::ReleaseAllInterfacesCallBack
    055dfc24 71935e84 clr!RCWCleanupList::ReleaseRCWListRaw+0xd, calling clr!RCW::Cleanup
    055dfc2c 71935e61 clr!RCWCleanupList::ReleaseRCWListInCorrectCtx+0xd1, calling clr!RCWCleanupList::ReleaseRCWListRaw
    055dfc40 71936da2 clr!RCWCleanupList::CleanupAllWrappers+0x155, calling clr!RCWCleanupList::ReleaseRCWListInCorrectCtx
    055dfc58 718511c5 clr!ClrFlsIncrementValue+0x9, calling clr!ClrFlsGetBlock
    055dfc94 719f1800 clr!SyncBlockCache::DeleteSyncBlock+0xaa, calling clr!_EH_epilog3
    055dfc9c 719f1725 clr!SyncBlockCache::CleanupSyncBlocks+0xd0, calling clr!RCWCleanupList::CleanupAllWrappers
    055dfcec 719f168c clr!Thread::DoExtraWorkForFinalizer+0x81, calling clr!SyncBlockCache::CleanupSyncBlocks
    055dfd04 71928744 clr!WKS::GCHeap::FinalizerThreadWorker+0x22f, calling clr!Thread::DoExtraWorkForFinalizer
    055dfd44 71889843 clr!REGUTIL::EnvGetString+0xfc, calling clr!__security_check_cookie
    055dfd4c 718c7d8d clr!Thread::DoExtraWorkForFinalizer+0x1ca
    055dfd64 718c7dfb clr!Thread::DoExtraWorkForFinalizer+0x256, calling clr!Thread::DoExtraWorkForFinalizer+0x163
    055dfd98 7196b5f2 clr!ThreadStore::TransferStartedThread+0xfd, calling clr!_EH_epilog3
    055dfdd4 718898fd clr!SHash<StringSHashTraits<_ConfigStringKeyValuePair,unsigned short,CaseSensitiveStringCompareHash<unsigned short> > >::Lookup+0x11, calling clr!SHash<StringSHashTraits<_ConfigStringKeyValuePair,unsigned short,CaseSensitiveStringCompareHash<unsigned short> > >::Lookup
    055dfde0 7188998a clr!EEConfig::GetConfiguration_DontUse_+0x1b0, calling clr!SHash<StringSHashTraits<_ConfigStringKeyValuePair,unsigned short,CaseSensitiveStringCompareHash<unsigned short> > >::Lookup
    055dfe0c 718c7ec8 clr!Thread::DoExtraWorkForFinalizer+0x618, calling clr!Thread::DoExtraWorkForFinalizer+0x1d4
    055dfe68 719141c6 clr!WKS::GCHeap::FinalizerThreadStart+0x198, calling clr!Thread::DoExtraWorkForFinalizer+0x5bd
    055dfe84 77a9e023 ntdll!RtlFreeHeap+0x105, calling ntdll!RtlpLowFragHeapFree
    055dfee4 7196a0c1 clr!Thread::intermediateThreadProc+0x4d
    055dff74 7196a0af clr!Thread::intermediateThreadProc+0x3b, calling clr!_alloca_probe_16
    055dff88 775733aa kernel32!BaseThreadInitThunk+0xe
    055dff94 77aa9ef2 ntdll!__RtlUserThreadStart+0x70
    055dffd4 77aa9ec5 ntdll!_RtlUserThreadStart+0x1b, calling ntdll!__RtlUserThreadStart

    Friday, May 31, 2013 10:12 PM


All replies

  • Hi There,

    I would like to check related code to figure out what code cause this release action.

    Would you like to describe this issue more details, such as the project type, .net framework version?

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 3, 2013 12:33 AM
  • Hello Mike,

    I appreciate your time on this!

    The project i am working on is targeted towards .NET 4.5. There's a lot of COM interop stuff that gets connected with legacy code. Code also leverages MSXML 4.0 SP2 (This surely would elevate this problem!) - I am looking for some kind of concrete diagnostic/debugging techniques to be able to determine the faulty code and root cause.

    Is there anyway when the breakpoint gets hit in the debugger, can we extract what information/RCW CLR is failing to release ?

    Thanks again!

    Monday, June 3, 2013 4:55 PM
  • Hi There,

    Thank you for your clarification.

    I am trying to involve some other one into this case, it will take some time, thank you for your patience.

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 4, 2013 1:54 AM
  • You can have a look at MDA. When you activate it, you can get some hint information to find the offending code:

    Best regards,

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 5, 2013 7:32 PM