473,881 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Random crashes in mscorwks.dll...

I really am banging my head with this one...

I have a regular unmanaged C++ application that is using mixed DLLs to
(amongst other things) call a C# back-end (which is using ADO .NET). I am
getting random crashes, typically after 15-60 minutes of inactivity. The
error message and call stack are listed below.

Unhandled exception at 0x792483e0 (mscorwks.dll) in
debug_build_wks _crash.dmp: 0xC0000005: Access violation reading location
0xfeef00da.

mscorwks.dll!Co rExitProcess() + 0x5e2c
mscorwks.dll!ND _CopyObjDst() + 0x2fa9
mscorwks.dll!Co rExitProcess() + 0x4a3c
mscoree.dll!__C orDllMain@12() + 0x1c
ntdll.dll!_Ldrp CallInitRoutine @16() + 0x14
ntdll.dll!_LdrS hutdownThread@0 () + 0xdb
kernel32.dll!_E xitThread@4() + 0x3e
mscorwks.dll!Re leaseFusionInte rfaces() + 0x44a7f
mscorwks.dll!Re leaseFusionInte rfaces() + 0x441b0
kernel32.dll!_B aseThreadStart@ 8() + 0x37

In an attempt to fix or identify the problem I have:

1. Searched the code for places where unmanaged code could be corrupting
managed memory.
2. Tracked (using Trace.WriteLine ()) garbage collection. This seemed to
indicate that garbage collection (of my objects) had taken place long before
the crash.
3. Implemented the workaround for the mixed DLL loading problem
(http://support.microsoft.com/?id=814472).

I can't make much sense of the call stack, even this
(http://msdn.microsoft.com/library/de...xitprocess.asp) document doesn't really help me.

I would really appreciate either suggestions as to what might be causing the
problem or ideas that might help me track it down.

Thanks

Nov 17 '05 #1
8 15314

It looks like there is no symbols for mscorwks.dll on your system
(exports are loaded instead), and therefore the call stack is incorrect.
You should obtain the good symbols (e.g. download them from
the symbol server) to get the correct call stack.

Regards,
Oleg

Nov 17 '05 #2
Sorry... The call stack was created from a dump file which for some reason
didn't pick up the symbols when I opened it in VS. Here is the actual call
stack (I have typed it from a screen-shot and triple checked for typos):

mscorwks.dll!Th read::UnhijackT hread() + 0x70d9f
mscorwks.dll!Th read::RareEnabl ePreemptiveGC() + 0x36
mscorwks.dll!Th read::RareDisab lePreemptiveGC( ) + 0x49cb6
mscorwks.dll!Sy stemDomain::Run DllMain() + 0x7d
mscorwks.dll!Ex ecuteDLL() + 0x7fd12
mscoree.dll!__C orDllMain@12() + 0x1c
ntdll.dll!_Ldrp CallInitRoutine @16() + 0x14
ntdll.dll!_LdrS hutdownThread@0 () + 0xdb
kernel32.dll!_E xitThread@4() + 0x3e
mscorwks.dll!Th readpoolMgr::Wo rkerThreadStart () + 0x123
mscorwks.dll!Th readpoolMgr::in termediateThrea dProc() + 0x44
kernel32.dll!_B aseThreadStart@ 8() + 0x37

I have since tried using pageheap
(http://support.microsoft.com/default...b;en-us;286470 and
http://support.microsoft.com/default...b;en-us;264471) to detect
memory corruption in the application. Despite identifying and fixing a memory
problem the application still crashes in the same way.

I will be very gratefull for any help you can provide... :-)
Nov 17 '05 #3
Hello,

I believe some problem araises during thread (from thread pool)
finalization. May be this is somehow related to an unmanaged code that was
executed in that thread.
Can you replace (for testing purposes) asynchronous calls to explicit
threads. The earlier you will finalize these threads, the better.
--
Vladimir Nesterovsky
e-mail: vl******@nester ovsky-bros.com
home: http://www.nesterovsky-bros.com
Sorry... The call stack was created from a dump file which for some reason
didn't pick up the symbols when I opened it in VS. Here is the actual call
stack (I have typed it from a screen-shot and triple checked for typos):

mscorwks.dll!Th read::UnhijackT hread() + 0x70d9f
mscorwks.dll!Th read::RareEnabl ePreemptiveGC() + 0x36
mscorwks.dll!Th read::RareDisab lePreemptiveGC( ) + 0x49cb6
mscorwks.dll!Sy stemDomain::Run DllMain() + 0x7d
mscorwks.dll!Ex ecuteDLL() + 0x7fd12
mscoree.dll!__C orDllMain@12() + 0x1c
ntdll.dll!_Ldrp CallInitRoutine @16() + 0x14
ntdll.dll!_LdrS hutdownThread@0 () + 0xdb
kernel32.dll!_E xitThread@4() + 0x3e
mscorwks.dll!Th readpoolMgr::Wo rkerThreadStart () + 0x123
mscorwks.dll!Th readpoolMgr::in termediateThrea dProc() + 0x44
kernel32.dll!_B aseThreadStart@ 8() + 0x37

I have since tried using pageheap
(http://support.microsoft.com/default...b;en-us;286470 and
http://support.microsoft.com/default...b;en-us;264471) to detect
memory corruption in the application. Despite identifying and fixing a memory problem the application still crashes in the same way.

I will be very gratefull for any help you can provide... :-)

Nov 17 '05 #4
In addition, try to run these commands in Command Window
after you have opened the dump:

..load sos
!DumpStack

What call stack will be shown?

Regards,
Oleg


Nov 17 '05 #5
The ouput is:

..load sos

!DumpStack
succeeded
Loaded Son of Strike data table version 5 from
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorwks.dll"
Current frame: ?ReturnToContex t@Thread@@QAEXP AVFrame@@H@Z+0x 2d
ChildEBP RetAddr Caller,Callee
0428f6d8 792a5ea4 ?RunDllMain@Sys temDomain@@SGJP AUHINSTANCE__@@ KPAX@Z+0x288,
calling ?ReturnToContex t@Thread@@QAEXP AVFrame@@H@Z
0428f78c 79246ff0 ?ExecuteDLL@@YG HPAUHINSTANCE__ @@KPAX@Z+0x3c0, calling
?RunDllMain@Sys temDomain@@SGJP AUHINSTANCE__@@ KPAX@Z
0428f7b0 792438ac _DllMain@12+0x3 3, calling
?EEDllMain@@YGH PAUHINSTANCE__@ @KPAX@Z
0428f7c4 791c049c _DllMain@12+0x1 17, calling @__security_che ck_cookie@4
0428f7c8 79b91ba8 (stub for mdToken: 0600002a (), calling 79b7a188
0428f7cc 79a2bbe7 79a2bbe7, calling 79b91ba3 (MethodDesc 0x79b91ba8
mdToken: 0600002a ()
0428f7dc 791b1b3a ?JIT_MonExit@@Y IXPAVObject@@@Z +0xf, calling
?DummyGetThread @@YGPAVThread@@ XZ
0428f81c 791ed194
?CallDescr@Meth odDesc@@QAE_JPB EPAVModule@@PAV MetaSig@@HPB_J@ Z+0x1b8, calling
_CallDescrWorke r@16
0428f850 791daddf ??0ArgIterator@ @QAE@PAEPAVMeta Sig@@H@Z+0x55, calling
?IsArgumentInRe gister@@YGHPAHE IHE0@Z
0428f864 791d94bc _CallDescrWorke r@16+0x30
0428f86c 791ed194
?CallDescr@Meth odDesc@@QAE_JPB EPAVModule@@PAV MetaSig@@HPB_J@ Z+0x1b8, calling
_CallDescrWorke r@16
0428f874 791ed1cd
?CallDescr@Meth odDesc@@QAE_JPB EPAVModule@@PAV MetaSig@@HPB_J@ Z+0x1f1, calling
?getFPReturn@@Y GXHAA_J@Z
0428f890 77f944cb _RtlpFreeToHeap Lookaside@8+0x1 f, calling
@RtlpInterlocke dPushEntrySList @8
0428f898 77f58bcd _RtlFreeHeap@12 +0x18f, calling _RtlpFreeToHeap Lookaside@8
0428f8a0 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428f8c0 77f944cb _RtlpFreeToHeap Lookaside@8+0x1 f, calling
@RtlpInterlocke dPushEntrySList @8
0428f8c8 77f58bcd _RtlFreeHeap@12 +0x18f, calling _RtlpFreeToHeap Lookaside@8
0428f8d0 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428f8e0 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428f8ec 79513737 _DllMain@12+0x1 19, calling @__security_che ck_cookie@4
0428f910 77f944cb _RtlpFreeToHeap Lookaside@8+0x1 f, calling
@RtlpInterlocke dPushEntrySList @8
0428f918 77f58bcd _RtlFreeHeap@12 +0x18f, calling _RtlpFreeToHeap Lookaside@8
0428f920 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428f938 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428f960 77f59037 _RtlFreeHeap@12 +0x5f9, calling __SEH_epilog
0428fa14 7917cff3 __CorDllMain@12 +0x40
0428fa2c 77f5b42c _LdrpCallInitRo utine@16+0x14
0428fa4c 77f629df _LdrShutdownThr ead@0+0xdb, calling _LdrpCallInitRo utine@16
0428fa74 7929b73f
?SetDelayedInhe ritedSecuritySt ack@Thread@@QAE XPAVCompressedS tack@@@Z+0x1f,
calling ?Release@Compre ssedStack@@QAEJ XZ
0428fac8 77e74af8 _ExitThread@4+0 x3e, calling _LdrShutdownThr ead@0
0428fb20 792ec273 ?intermediateTh readProc@Thread poolMgr@@CGKPAX @Z+0x44
0428fb2c 771256e2 _DllMain@12+0x2 7, calling
?_typesDllMain@ @YGHPAUHINSTANC E__@@KPAX@Z
0428fb74 77f58a3a _RtlAllocateHea p@12+0xe8c, calling __SEH_epilog
0428fb88 762fa952 ?I_CryptTlsDllM ain@@YGHPAUHINS TANCE__@@KPAX@Z +0x19f,
calling __SEH_epilog
0428fbac 76317375 ?CryptPFXDllMai n@@YGHPAUHINSTA NCE__@@KPAX@Z+0 x24, calling
?EncodeDecodeDl lMain@@YGHPAUHI NSTANCE__@@KPAX @Z
0428fbd8 77f58a3a _RtlAllocateHea p@12+0xe8c, calling __SEH_epilog
0428fbdc 76f611cd _ldapMalloc@8+0 x17, calling _LdrpDllTagProc edures+0x1
0428fbf0 76f61234 _AddPerThreadEn try@4+0x4d, calling
_RtlComputeImpo rtTableHash@12+ 0x18
0428fc00 76f610e6 _LdapDllInit@12 +0x67, calling _AddPerThreadEn try@4
0428fc08 77f5b42c _LdrpCallInitRo utine@16+0x14
0428fc30 77f62b67 _LdrpInitialize Thread@4+0xe3, calling
_RtlDeactivateA ctivationContex tUnsafeFast@4
0428fc38 77f62bc6 _LdrpInitialize Thread@4+0x142, calling __SEH_epilog
0428fc9c 77f55432 _LdrpInitialize @12+0x26f, calling _RtlLeaveCritic alSection@4
0428fca0 77f5c474 _ZwTestAlert@0+ 0xc
0428fca4 77f5541d _LdrpInitialize @12+0x25a, calling __SEH_epilog
0428fd18 77f5541d _LdrpInitialize @12+0x25a, calling __SEH_epilog
0428fd1c 77f5b644 _ZwContinue@8+0 xc
0428fd20 77f75d8f _KiUserApcDispa tcher@20+0xf, calling _ZwContinue@8
0428fdd4 77f944a8 _RtlpAllocateFr omHeapLookaside @4+0x42, calling __SEH_epilog
0428fdd8 77f57d70 _RtlAllocateHea p@12+0x1c2, calling
_RtlpAllocateFr omHeapLookaside @4
0428ffa4 792ec261 ?intermediateTh readProc@Thread poolMgr@@CGKPAX @Z+0x32,
calling __alloca_probe
0428ffb4 77e7d28e _BaseThreadStar t@8+0x37

I have managed to "solve" the problem by doing a complete "rebuild" i.e.
clearing my development folder and getting files from scratch from source
control. I believe that the problem may be related to the fact that I had 23
different versions of a managed DLL in various locations with five different
timestamps. VS copies managed DLLs when it is building and I don't think the
copies were being correctly updated.

I have accepted your answer because you have provided me with an additional
mechanism to try and identify the problem. I can't make much sense of the
managed call stack but if there are any hints in there please let me know.

Thanks for taking the time to post... :-)

Nov 17 '05 #6
Update - we are still working to resolve this. The issue seems to be related
to (i) the use of connection pooling and (ii) running the application on dual
processor machines.
Nov 17 '05 #7
Shy

Gary Joy wrote:
*Update - we are still working to resolve this. The issue seems to be
related
to (i) the use of connection pooling and (ii) running the application
on dual
processor machines. *

I'm having a similar problem. In my case, whenever it happens I stopped
the application and tried to find the renegade thread in the visual
studio.
It appears that it's not even one of mine...
Does anyone know what can be done?

--
Shy
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Apr 26 '06 #8
My apologies for not updating this when we finally found a "solution". With
the help of MCS we solved the problem by disabling thread attach and detach
notification for the troublesome DLLs.

This was some time ago and I have since changed jobs so cannot provide much
more information than that. I do remember that Microsoft were very helpful in
getting to the bottom of the problem.

P.S. I hope you don't *need* thread attach and detach notifications.. . ;-)
Apr 26 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3864
by: greeningster | last post by:
I have written an application in Visual C++ for a customer but it seems to crash randomly. Could anyone give me any help on how I could track this down ? Also, there appears there might be memory leaks too. How can i track these down ?
0
2819
by: Niklas Pettersson | last post by:
A deffinite bug in mscorwks.dll makes my managed service crash abruptly. When hooking up windbg it turns out to be an "access violation" in the mscorwks assembly memory space. Every time it happens the managed stack is dealing with datasets. The native stackdump reveals that the GC is where it breaks. Some experimenting has showed that the issue is only reproducable in multithreaded environment. When I run the same stuff in its own...
0
1850
by: techie | last post by:
I have created an event sink in my ATL COM project. The event sink receives events from a C# component. There is no problem with receiving events but when my COM object is released I get an access violation - (MSCORWKS.DLL): 0xC0000005: Access Violation. At first I thought it could be due to my C++ code but after quite a lot of investigation I don't think there is nothing wrong with it. The access violation occurs after the destructor...
0
1078
by: Steve McLellan | last post by:
Hi, Not sure when this problem surfaced but when I'm debugging a mixed c++ app, some (but not all) of the breakpoints in the unmanaged code are hit but because the top of the call stack is shown as mscorwks with a memory address, and NOT the function where the breakpoint resides, I get a message saying that there's no source code available and have to manually go up a stage in the call stack to see the function I'm interested in. If I...
0
1137
by: techie | last post by:
Hi, I've created a COM object in VC++ that I call from XMetal. I pass the COM object (via a XMetal macro) my XMetal Application object by a put_ method. In my put_ method I call QueryInterface for the _Application interface and create an instance of a class called CXMetalApp: STDMETHODIMP CXMLEditorInterface::put_Application(LPDISPATCH newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState())
2
4569
by: Ronald | last post by:
I just started with dotnetnuke, and with a wrong login (wrong password on a clean install i can crash the application pool from IIS. (when i login with the right username/password information the site works fine, i can do anything it is supposed to do) I have the following setup: -Windows 2003 x64 (fully patched, clean install) -Dotnetframework 2.0.50727 -Dotnetnuke 4.3.1
0
1248
by: Tom | last post by:
When I try to connect to a MS SQL Server 2000 my application always crashes (without message). In the event log I find the following error: Faulting application testapp.exe, version 7.2.2368.12623, stamp 449f780f, faulting module mscorwks.dll, version 2.0.50727.42, stamp 4333e7ec, debug? 0, fault address 0x00046cb1. When I reinstall the .Net Framework it works for some days but then crashes again.
0
1458
by: cgp | last post by:
Whenever I attempt to add a reference to a project or add an item to the toolbox, VS 2005 crashes. I have completely uninstalled and reintalled VS and still have the issue. The error signature is as follows: AppName: devenv.exe AppVer: 8.0.50727.42 AppStamp:4333e699 ModName: mscorwks.dll ModVer: 2.0.50727.42 ModStamp:4333e7ec fDebug: 0 Offset: 0000b1d9 Thanks
3
3890
by: John Fairhurst | last post by:
Hi, The following code should select the specified number of records randomly from the database <% .... query = "SELECT FROM " Set RS = Server.CreateObject("ADODB.Recordset")
0
9928
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11100
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10401
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7110
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5781
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.