Access violation loading .NET executables simultaneously

G

Guest

Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
P

Peter Huang

Hi,

I think you may try to move the code line
Interlocked.Increment(ref nCount);

to the MainThread.
for(int n = 0; n < int.Parse(args[0]); n++)
{
Interlocked.Increment(ref nCount); //move the code line here.
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

You may have a try and let me know the result.

Because there is one possibility that after a thread is started but before
it called the interlocked.Increment(ref nCount); when the main thread has
been run and exit.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Peter - thanks for your post.

But the code below is not the problem, I just included it is as an example
of what we are doing in the test harness to load our exe. The real problem is
that trying to simultaneously start up a bunch of .NET exes (no matter how
simple) results in some instances returning an access violation (0xC0000005),
while starting up multiple unmanaged exes doesn't cause any problems. Where
we increment of our counter is not going to cause that! (BTW, I did make your
change, and as expected it had no effect.)

Does anyone have any ideas about what might cause this access violation? Is
this a problem with the runtime initialization falling over, or something
more subtle?

"Peter Huang" said:
Hi,

I think you may try to move the code line
Interlocked.Increment(ref nCount);

to the MainThread.
for(int n = 0; n < int.Parse(args[0]); n++)
{
Interlocked.Increment(ref nCount); //move the code line here.
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

You may have a try and let me know the result.

Because there is one possibility that after a thread is started but before
it called the interlocked.Increment(ref nCount); when the main thread has
been run and exit.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Just for some further information:

I installed some debugging tools and symbols on this PC and got this more
detailed debug info:

FAULTING_IP:
mscorwks!SetupThread+21
791cfea1 397850 cmp [eax+0x50],edi

EXCEPTION_RECORD: ffffffff -- (.exr ffffffffffffffff)
ExceptionAddress: 791cfea1 (mscorwks!SetupThread+0x00000021)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000050
Attempt to read from address 00000050

STACK_TEXT:
0012fa64 791c7ebf 0012fa80 7928841e 00000000 mscorwks!SetupThread+0x21
0012fa6c 7928841e 00000000 793e6518 793e6518 mscorwks!CoInitializeEE+0x73
0012fa80 7928c344 00000800 7c5736e0 00000000
mscorwks!SetBufferOverrunHandler+0x24
0012faa8 7928c464 0012fab4 00000000 0012faf4 mscorwks!CCompRC::GetLibrary+0x26
0012fab8 79288f16 0000171a 0013a650 00000400 mscorwks!CCompRC::LoadString+0x11
0012faf4 792457d2 00000000 0000171b 0000171a mscorwks!CorMessageBox+0x51
0012ff38 791ce9cb 00000000 793dd0b8 7ffdf000 mscorwks!EEDllMain+0x1f1
0012ff60 791ced2d 00000002 00000000 793dd0b8 mscorwks!EEStartup+0x15e
0012ff90 791b16d2 00000002 00136928 0012ffc0 mscorwks!TryEEStartup+0x21
0012ffa0 791c6edf 00000002 00000004 00000000 mscorwks!CoInitializeEE+0x38
0012ffb0 7917d0b8 00000008 791b0000 0012fff0 mscorwks!_CorExeMain+0x41
0012ffc0 7c581af6 00000004 00000008 7ffdf000 mscoree!_CorExeMain+0x30
0012fff0 00000000 0040263e 00000000 000000c8 KERNEL32!BaseProcessStart+0x3d

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
P

Peter Huang

Hi Munter,

Thank you for your input. AV exception is usually caused by accessing
certain memory which has not been allocated or has been released. As this
issue, can you send me a simple reproduce sample to me by removing "online"
from my email address together with detailed reproduce steps so that we can
isolate and identity the problem more quickly.

Look forward to hearing from you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang

Hi,

I have received your mail and as you said, I can not reproduce the problem
on my side.
So far I think you may try to applied .net framework 1.1 sp1 to see if that
helps to resolved the problem.
If that did not work I think you may need to contact MS PSS for detailed
debugging,e.g. analyze the crash dump or live debugging and so on which has
beyond the newsgroup support boundary.

Here is the PSS support website.
http://support.microsoft.com

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks Peter, but given the number of people having problems with SP1, I'm
not sure we'll be rushing to put this on to a production server. We will
build a new production box before we try and rebuild, repair or upgrade our
existing server.
 
G

Guest

More information on this error, using msdebug tools.

Stack dump of failed process:
CommandLine: C:\TheBug\stef_dbg\sleep_dotnet.exe 5
Symbol search path is:
srv*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00400000 00408000 sleep_dotnet.exe
ModLoad: 77f80000 77ffd000 ntdll.dll
ModLoad: 79170000 79196000 C:\WINNT\system32\mscoree.dll
ModLoad: 7c570000 7c628000 C:\WINNT\system32\KERNEL32.dll
ModLoad: 7c2d0000 7c332000 C:\WINNT\system32\ADVAPI32.dll
ModLoad: 77d30000 77da1000 C:\WINNT\system32\RPCRT4.DLL
(5340.52f4): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00131f04 ecx=00000009 edx=00000000 esi=7ffdf000 edi=00131f80
eip=77f813b1 esp=0012f984 ebp=0012fc98 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
ntdll!DbgBreakPoint:
77f813b1 cc int 3
0:000> bp mscorwks!ThreadStore::InitThreadStore
Bp expression 'mscorwks!ThreadStore::InitThreadStore' could not be resolved,
adding deferred bp
0:000> g
ModLoad: 70a70000 70ad5000 C:\WINNT\system32\SHLWAPI.dll
ModLoad: 78000000 78045000 C:\WINNT\system32\msvcrt.dll
ModLoad: 77f40000 77f7e000 C:\WINNT\system32\GDI32.dll
ModLoad: 77e10000 77e75000 C:\WINNT\system32\USER32.DLL
ModLoad: 791b0000 79412000
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll
ModLoad: 7c340000 7c396000
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\MSVCR71.dll
ModLoad: 79040000 79085000
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion.dll
ModLoad: 782f0000 78538000 C:\WINNT\system32\SHELL32.dll
ModLoad: 71710000 71794000 C:\WINNT\system32\COMCTL32.DLL
(5340.52f4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00010246
mscorwks!SetupThread+0x21:
791cfea1 397850 cmp [eax+0x50],edi ds:0023:00000050=????????
0:000> d [eax+0x50]
00000050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
00000060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
00000070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
00000080 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
00000090 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
000000a0 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
000000b0 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
000000c0 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
0:000> .load C:\WINNT\Microsoft.NET\Framework\v1.1.4322\sos.dll
0:000> !DumpStack
succeeded
Loaded Son of Strike data table version 5 from
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll"
Current frame: mscorwks!SetupThread+0x21
ChildEBP RetAddr Caller,Callee
0012fa64 791c7ebf mscorwks!CoInitializeEE+0x73, calling mscorwks!SetupThread
0012fa6c 7928841e mscorwks!SetBufferOverrunHandler+0x24, calling
mscorwks!CoInitializeEE
0012fa80 7928c344 mscorwks!CCompRC::GetLibrary+0x26
0012faa8 7928c464 mscorwks!CCompRC::LoadString+0x11, calling
mscorwks!CCompRC::GetLibrary
0012fab8 79288f16 mscorwks!CorMessageBox+0x51, calling
mscorwks!CCompRC::LoadString
0012fae4 791c5d81 mscorwks!WszGetModuleFileName+0x8c, calling
KERNEL32!GetModuleFileNameW
0012faf4 792457d2 mscorwks!EEDllMain+0x1f1, calling mscorwks!CorMessageBox
0012fb5c 77f83413 ntdll!RtlReleasePebLock+0xf
0012fb74 77f83413 ntdll!RtlReleasePebLock+0xf
0012fb7c 77f85321 ntdll!RtlQueryEnvironmentVariable_U+0x20b, calling
ntdll!RtlReleasePebLock
0012fb80 77f850a8 ntdll!RtlQueryEnvironmentVariable_U+0x20c, calling
ntdll!RtlQueryEnvironmentVariable_U+0x1f0
0012fb94 77f83413 ntdll!RtlReleasePebLock+0xf
0012fb9c 77f85321 ntdll!RtlQueryEnvironmentVariable_U+0x20b, calling
ntdll!RtlReleasePebLock
0012fba0 77f850a8 ntdll!RtlQueryEnvironmentVariable_U+0x20c, calling
ntdll!RtlQueryEnvironmentVariable_U+0x1f0
0012fbdc 77f843a3 ntdll!RtlNtStatusToDosError+0x1c, calling
ntdll!RtlNtStatusToDosErrorNoTeb
0012fbe8 7c573eae KERNEL32!BaseSetLastNTError+0x13, calling
KERNEL32!SetLastError
0012fbf4 7c57909f KERNEL32!GetEnvironmentVariableW+0x8b, calling
KERNEL32!BaseSetLastNTError
0012fc18 791bbfae mscorwks!WszGetEnvironmentVariable+0x124, calling
KERNEL32!GetEnvironmentVariableW
0012fc28 791bbfc1 mscorwks!WszGetEnvironmentVariable+0x137, calling
mscorwks!__security_check_cookie
0012fc40 77f83413 ntdll!RtlReleasePebLock+0xf
0012fc48 77f85321 ntdll!RtlQueryEnvironmentVariable_U+0x20b, calling
ntdll!RtlReleasePebLock
0012fc4c 77f850a8 ntdll!RtlQueryEnvironmentVariable_U+0x20c, calling
ntdll!RtlQueryEnvironmentVariable_U+0x1f0
0012fc88 77f843a3 ntdll!RtlNtStatusToDosError+0x1c, calling
ntdll!RtlNtStatusToDosErrorNoTeb
0012fc94 7c573eae KERNEL32!BaseSetLastNTError+0x13, calling
KERNEL32!SetLastError
0012fca0 7c57909f KERNEL32!GetEnvironmentVariableW+0x8b, calling
KERNEL32!BaseSetLastNTError
0012fcc4 791bbfae mscorwks!WszGetEnvironmentVariable+0x124, calling
KERNEL32!GetEnvironmentVariableW
0012fcd4 791bbfc1 mscorwks!WszGetEnvironmentVariable+0x137, calling
mscorwks!__security_check_cookie
0012fd98 7c2d1bb3 *** ERROR: Symbol file could not be found. Defaulted to
export symbols for C:\WINNT\system32\ADVAPI32.dll -
ADVAPI32!RegCloseKey+0x2f4, calling ntdll!RtlNtStatusToDosError
0012fdac 77f843a3 ntdll!RtlNtStatusToDosError+0x1c, calling
ntdll!RtlNtStatusToDosErrorNoTeb
0012fdb8 7c2d1bb3 ADVAPI32!RegCloseKey+0x2f4, calling
ntdll!RtlNtStatusToDosError
0012fde0 77f843a3 ntdll!RtlNtStatusToDosError+0x1c, calling
ntdll!RtlNtStatusToDosErrorNoTeb
0012fdec 7c2d19d5 ADVAPI32!RegCloseKey+0x116, calling
ntdll!RtlNtStatusToDosError
0012fe00 77f843a3 ntdll!RtlNtStatusToDosError+0x1c, calling
ntdll!RtlNtStatusToDosErrorNoTeb
0012fe0c 7c2d19d5 ADVAPI32!RegCloseKey+0x116, calling
ntdll!RtlNtStatusToDosError
0012fe74 7c2d1e59 ADVAPI32!RegQueryValueExW+0x7e, calling
ADVAPI32!RegCloseKey+0x17d
0012feac 791bc02b mscorwks!WszRegQueryValueEx+0x154, calling
ADVAPI32!RegQueryValueExW
0012fed4 7c2d1889 ADVAPI32+0x1889, calling ntdll!NtClose
0012fee4 7c2d184f ADVAPI32+0x184f, calling ADVAPI32+0x1852
0012feec 7c2d1918 ADVAPI32!RegCloseKey+0x59, calling ADVAPI32+0x1846
0012fef4 791bc515 mscorwks!REGUTIL::GetConfigDWORD+0xea
0012ff20 791c8030 mscorwks!MetaDataTracker::MetaDataTrackerInit+0x1e,
calling mscorwks!REGUTIL::GetConfigDWORD
0012ff38 791ce9cb mscorwks!EEStartup+0x15e, calling mscorwks!EEDllMain+0xc5
0012ff60 791ced2d mscorwks!TryEEStartup+0x21, calling mscorwks!EEStartup
0012ff90 791b16d2 mscorwks!CoInitializeEE+0x38, calling mscorwks!TryEEStartup
0012ffa0 791c6edf mscorwks!_CorExeMain+0x41, calling mscorwks!CoInitializeEE
0012ffb0 7917d0b8 mscoree!_CorExeMain+0x30
0012ffc0 7c581af6 KERNEL32!BaseProcessStart+0x3d

I’ve been able to narrow why it’s AVing, seems that it can’t create/open a
file mapping for its PrivateIPCControlBlock.

Then, because CreatePrivateBlockOnPid return ERROR_ALREADY_EXISTS,
InitializeIPCManager will try to display an error message box.

But! Because the g_pThreadStore wasn’t initialized yet (via
InitThreadManager), something that calls CorMessageBox ends up calling

CoInitializeEE which ends up calling SetupThread() which tries to use
g_pThreadStore->m_PendingThreadCount != 0.



Note: Following are some snippets of code (and ASM).
791cdcd7 e883feffff call
mscorwks!IPCWriterInterface::CreatePrivateBlockOnPid (791cdb5f)
0:000>eax=800700b7 ebx=ffffffff ecx=e3ec7266 edx=ffffffff esi=00005288
edi=00000000
eip=791cdcdc esp=0012fb18 ebp=0012ff38 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246
mscorwks!EEDllMain+0x15c:791cdcdc 3db7000780 cmp eax,0x800700b7

// ---------------------------------------------------------------------------
// Initialize InterProcess Communications for COM+
// 1. Allocate an IPCManager Implementation and hook it up to our interface *
// 2. Call proper init functions to activate relevant portions of IPC block
// ---------------------------------------------------------------------------
static HRESULT InitializeIPCManager(void)
{
HRESULT hr = S_OK;
HINSTANCE hInstIPCBlockOwner = 0;
.. . .
// Generate IPCBlock for our PID. Note that for the other side of
the debugger,
// they'll hook up to the debuggee's pid (and not their own). So we
still
// have to pass the PID in.
è hr = g_pIPCManagerInterface->CreatePrivateBlockOnPid(pid, FALSE,
&hInstIPCBlockOwner);

if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))
{
// We failed to create the IPC block because it has already
been created. This means that
// two mscoree's have been loaded into the process.
WCHAR strFirstModule[256];
WCHAR strSecondModule[256];

// Get the name and path of the first loaded MSCOREE.DLL.
if (!hInstIPCBlockOwner ||
!WszGetModuleFileName(hInstIPCBlockOwner, strFirstModule, 256))
wcscpy(strFirstModule, L"<Unknown>");

// Get the name and path of the second loaded MSCOREE.DLL.
if (!WszGetModuleFileName(g_pMSCorEE, strSecondModule, 256))
wcscpy(strSecondModule, L"<Unknown>");

// Load the format strings for the title and the message body.
è CorMessageBox(NULL, IDS_EE_TWO_LOADED_MSCOREE_MSG,
IDS_EE_TWO_LOADED_MSCOREE_TITLE, MB_ICONSTOP, TRUE, strFirstModule,
strSecondModule);

goto errExit;
}

errExit:
// If any failure, shut everything down.
if (!SUCCEEDED(hr))
TerminateIPCManager();
return hr;
}

BOOL InitThreadManager()
{
.. . .
è return ThreadStore::InitThreadStore(); ç This is where g_pThreadStore
is initialially allocated.
.. . .
}

HRESULT STDMETHODCALLTYPE CoInitializeEE(DWORD fFlags)
{
LOCKCOUNTINCL("CoInitializeEE in Ceemain");
EnterCriticalSection(&g_LockStartup);

// Increment RefCount, if it is one then we
// need to initialize the EE.
g_RefCount++;
if(g_RefCount <= 1 && !g_fEEStarted && !g_fEEInit) {
g_EEStartupStatus = TryEEStartup(fFlags);

// We did not have a Thread structure when we EnterCriticalSection.
// Bump the counter now to account for it.
INCTHREADLOCKCOUNT();
if(SUCCEEDED(g_EEStartupStatus) && (fFlags & COINITEE_MAIN) == 0) {
SystemDomain::SetupDefaultDomain();
}
}

LeaveCriticalSection(&g_LockStartup);
LOCKCOUNTDECL("CoInitializeEE in Ceemain");

return SUCCEEDED(g_EEStartupStatus) ? (SetupThread() ? S_OK :
E_OUTOFMEMORY) : g_EEStartupStatus;
}

Thread* SetupThread()
{
.. . .
// Normally, HasStarted is called from the thread's entrypoint to
introduce it to
// the runtime. But sometimes that thread is used for DLL_THREAD_ATTACH
notifications
// that call into managed code. In that case, a call to SetupThread
here must
// find the correct Thread object and install it into TLS.
if (g_pThreadStore->m_PendingThreadCount != 0)
{
DWORD ourThreadId = ::GetCurrentThreadId();
ThreadStore::LockThreadStore();
{
_ASSERTE(pThread == NULL);

while ((pThread = g_pThreadStore->GetAllThreadList(pThread,
Thread::TS_Unstarted, Thread::TS_Unstarted)) != NULL)

if (pThread->GetThreadId() == ourThreadId)
break;
}

ThreadStore::UnlockThreadStore();

// It's perfectly reasonable to not find this guy. It's just an
unrelated
// thread spinning up.
if (pThread)
return (pThread->HasStarted() ? pThread : NULL);
}
.. . .
return NULL;
}

I guess the question is this, why are some processes unable to create/open
onto their IPC block? I have verified that the named being used is valid.

Let me know what you think.

After another quick look, it seems that CreatePrivateBlockOnPid almost
always returns ERROR_ALREADY_EXIST when running within the debugger on
BRSPTECH1. Yet on my machine, using the same tools, it doesn’t do so. And
because of the execution path taken when ERROR_ALREADY_EXIST is return,
another call is made to CoInitializeEE(0) via SetBufferOverrunHandler
(calling init is the first thing this function does).

The second time CoInitializeEE is called, the global variable
g_EEStartupStatus will not have been initialized yet (at least not from the
code present in the SSCLI tree). Since this can hold anything the process
loaded, there is a chance that it holds 0 (S_OK) in which case it will do a
call to SetupThread, which in turn will cause an Access Violation because of
g_pThreadStore->m_PendingThreadCount.

Muntz said:
Just for some further information:

I installed some debugging tools and symbols on this PC and got this more
detailed debug info:

FAULTING_IP:
mscorwks!SetupThread+21
791cfea1 397850 cmp [eax+0x50],edi

EXCEPTION_RECORD: ffffffff -- (.exr ffffffffffffffff)
ExceptionAddress: 791cfea1 (mscorwks!SetupThread+0x00000021)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000050
Attempt to read from address 00000050

STACK_TEXT:
0012fa64 791c7ebf 0012fa80 7928841e 00000000 mscorwks!SetupThread+0x21
0012fa6c 7928841e 00000000 793e6518 793e6518 mscorwks!CoInitializeEE+0x73
0012fa80 7928c344 00000800 7c5736e0 00000000
mscorwks!SetBufferOverrunHandler+0x24
0012faa8 7928c464 0012fab4 00000000 0012faf4 mscorwks!CCompRC::GetLibrary+0x26
0012fab8 79288f16 0000171a 0013a650 00000400 mscorwks!CCompRC::LoadString+0x11
0012faf4 792457d2 00000000 0000171b 0000171a mscorwks!CorMessageBox+0x51
0012ff38 791ce9cb 00000000 793dd0b8 7ffdf000 mscorwks!EEDllMain+0x1f1
0012ff60 791ced2d 00000002 00000000 793dd0b8 mscorwks!EEStartup+0x15e
0012ff90 791b16d2 00000002 00136928 0012ffc0 mscorwks!TryEEStartup+0x21
0012ffa0 791c6edf 00000002 00000004 00000000 mscorwks!CoInitializeEE+0x38
0012ffb0 7917d0b8 00000008 791b0000 0012fff0 mscorwks!_CorExeMain+0x41
0012ffc0 7c581af6 00000004 00000008 7ffdf000 mscoree!_CorExeMain+0x30
0012fff0 00000000 0040263e 00000000 000000c8 KERNEL32!BaseProcessStart+0x3d

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
Y

Yan-Hong Huang[MSFT]

Hi Anthony,

I have reviewed the email that you sent to Peter and Stephane. It seems
that Stephane in PSS is helping you on it already. We will provide the
information here to Stephane also. Stephane will continue to work with you
on it.

By the way, I agree with you that setting up a new server to test the
application first. When it goes through the test, you can deploy it to your
real product server.

Please feel free to work with Stephane and post back here the result so
that the whole community can benefit from it. Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Tyler

We are experiencing the same problem. I was wondering if you were
able to find a solution.

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
G

Guest

Nope, the MSDN guys have basically said we need to contact MS product support
for some more detailed diagnostic analysis. But we are getting the problem on
two separate servers now.

Tyler said:
We are experiencing the same problem. I was wondering if you were
able to find a solution.

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
G

Guest

Fingers crossed, but after applying .NET 1.1 SP1, we are not getting the AV
using our test harness any more.

Muntz said:
Nope, the MSDN guys have basically said we need to contact MS product support
for some more detailed diagnostic analysis. But we are getting the problem on
two separate servers now.

Tyler said:
We are experiencing the same problem. I was wondering if you were
able to find a solution.

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 
G

Guest

Fingers crossed, but after applying .NET 1.1 SP1, we are not getting the AV
using our test harness any more.

Tyler said:
We are experiencing the same problem. I was wondering if you were
able to find a solution.

Muntz said:
Hi - we are MSDN Enterprise subscribers. Our no-spam email address is:
(e-mail address removed)

We have a production server (Win 2K SP4, .NET FW 1.1) with a service that
schedules jobs, each of which involves running a .NET executable with command
line params. When we try to schedule a number of these jobs at exactly the
same time, some of these jobs (i.e 1 in 20) are failing with an exit code of
0xC0000005. There is absolutely no difference between the params for a failed
job versus a successful job. First thing we do when the code enters Main is
to write an Application event log entry, but these are not being seen at all,
suggesting the exe has not even been loaded. The failure does not occur when
jobs are run one by one, or on other servers.

Dr Watson logs these as follows:

Application exception occurred:
App: (pid=20556)
When: 13/09/2004 @ 21:25:49.795
Exception number: c0000005 (access violation)

*----> System Information <----*
Computer Name: BRSPTECH1
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free

State Dump for Thread Id 0x4e50

eax=00000000 ebx=00000000 ecx=7ffde000 edx=793dd0b8 esi=00000000 edi=00000000
eip=791cfea1 esp=0012fa50 ebp=0012fa64 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246


function: CoInitializeCor
791cfe80 5e pop esi
791cfe81 7408 jz CoInitializeCor+0xb6eb (791d9f8b)
791cfe83 a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe88 ff4048 inc dword ptr [eax+0x48]
ds:00819ee6=????????
791cfe8b a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
791cfe90 ff4074 inc dword ptr [eax+0x74]
ds:00819ee6=????????
791cfe93 e86341feff call Ordinal71+0x3ffb (791b3ffb)
791cfe98 5d pop ebp
791cfe99 c20400 ret 0x4
791cfe9c a1cccb3d79
ds:793dcbcc=00000000
mov eax,[CorCreateMiniDump+0x7f709
(793dcbcc)]
FAULT ->791cfea1 397850 cmp [eax+0x50],edi
ds:00819ee6=????????
791cfea4 53 push ebx
791cfea5 8b1d10121b79
ds:791b1210=7c573a71
mov ebx,[Ordinal71+0x1210 (791b1210)]
791cfeab 56 push esi
791cfeac 0f856e6f0700 jne DllGetClassObjectInternal+0x100cd
(79246e20)
791cfeb2 68b0010000 push 0x1b0
791cfeb7 e88af5ffff call CoInitializeCor+0xba6 (791cf446)
791cfebc 59 pop ecx
791cfebd 8945f0 mov [ebp+0xf0],eax
ss:0094994a=????????
791cfec0 3bc7 cmp eax,edi
791cfec2 897dfc mov [ebp+0xfc],edi
ss:0094994a=????????
791cfec5 0f8496000000 je CoInitializeCor+0x16c1 (791cff61)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012FA64 791C7EBF 0012FA80 7928841E 00000000 793E6518 !CoInitializeCor
0012FA6C 7928841E 00000000 793E6518 793E6518 0012FAA8 !CoInitializeEE
0012FA80 7928C344 00000800 7C5736E0 00000000 80004005
!DllGetClassObjectInternal
0012FAA8 7928C464 0012FAB4 00000000 0012FAF4 79288F16 !Ordinal18
0012FAB8 79288F16 0000171A 0013A658 00000400 00000001 !Ordinal18
0012FAF4 792457D2 00000000 0000171B 0000171A 00000010 !Ordinal19
0012FF38 791CE9CB 00000000 793DD0B8 7FFDF000 7FFDE000
!DllGetClassObjectInternal
0012FF60 791CED2D 00000002 00000000 793DD0B8 7FFDF000 !CoInitializeCor
0012FF90 791B16D2 00000002 00136538 0012FFC0 791C6EDF !CoInitializeCor
0012FFA0 791C6EDF 00000002 00000004 00000000 7917D0B8 !Ordinal71
0012FFC0 7C581AF6 00000004 00000008 7FFDF000 C0000005 !CorExeMain
0012FFF0 00000000 0040259E 00000000 000000C8 00000100 kernel32!OpenEventA

*----> Raw Stack Dump <----*
0012fa50 00 08 00 00 00 e0 fd 7f - 2c ff 12 00 40 8e 3c 79 ........,...@.<y
0012fa60 ff ff ff ff 6c fa 12 00 - bf 7e 1c 79 80 fa 12 00 ....l....~.y....
0012fa70 1e 84 28 79 00 00 00 00 - 18 65 3e 79 18 65 3e 79 ..(y.....e>y.e>y
0012fa80 a8 fa 12 00 44 c3 28 79 - 00 08 00 00 e0 36 57 7c ....D.(y.....6W|
0012fa90 00 00 00 00 05 40 00 80 - 00 00 00 00 00 00 00 00 .....@..........
0012faa0 00 e0 fd 7f 00 00 00 00 - b8 fa 12 00 64 c4 28 79 ............d.(y
0012fab0 b4 fa 12 00 00 00 00 00 - f4 fa 12 00 16 8f 28 79 ..............(y
0012fac0 1a 17 00 00 58 a6 13 00 - 00 04 00 00 01 00 00 00 ....X...........
0012fad0 1c e1 27 79 20 04 35 7c - ff ff ff ff 02 00 00 00 ..'y .5|........
0012fae0 58 a6 13 00 60 96 15 00 - 81 5d 1c 79 00 00 1b 79 X...`....].y...y
0012faf0 28 fd 12 00 38 ff 12 00 - d2 57 24 79 00 00 00 00 (...8....W$y....
0012fb00 1b 17 00 00 1a 17 00 00 - 10 00 00 00 01 00 00 00 ................
0012fb10 28 fb 12 00 28 fd 12 00 - 05 40 00 80 01 00 00 00 (...(....@......
0012fb20 00 00 00 00 b7 00 07 80 - 3c 00 55 00 6e 00 6b 00 ........<.U.n.k.
0012fb30 6e 00 6f 00 77 00 6e 00 - 3e 00 00 00 00 00 00 00 n.o.w.n.>.......
0012fb40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012fb50 10 00 00 00 f6 08 01 00 - b4 fb 12 00 02 00 00 00 ................
0012fb60 13 34 f8 77 70 01 fd 77 - 10 00 00 00 f6 08 01 00 .4.wp..w........
0012fb70 cc fb 12 00 02 00 00 00 - 13 34 f8 77 70 01 fd 77 .........4.wp..w
0012fb80 21 53 f8 77 a8 50 f8 77 - 10 00 00 00 f6 08 01 00 !S.w.P.w........

We have been able to duplicate these failures using a simple test harness
that loads multiple instances of an executable concurrently. The 0xC0000005
error is returned when we try to load multiple instances of a simple .NET exe
concurrently, but not when we load an unmanaged exe. (The exe does nothing
except sleep for a specified length of time.)

We wrote two test harnesses, one using C++ and the other using C#, to load
the test executables. Both test harnesses have occasional failures trying to
load the .NET version of the sleep exe. They never fail with the unamanaged
sleep exe.

ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
…
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0x00000000(0)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)
ExitCode=0xC0000005(-1073741819)

Here is some of the C# harness code:

static public void RunProcess()
{
Interlocked.Increment(ref nCount);

try
{
Process oProcess = Process.Start(sFilename, sArguments);
if (oProcess != null)
{
oProcess.WaitForExit();
Console.WriteLine("ExitCode={0}", oProcess.ExitCode);
}
else
{
Console.WriteLine("Process.Start() failed.");
}
}
catch(Exception ex)
{
Console.WriteLine("Exception: {0}", ex.Message);
}

if (Interlocked.Decrement(ref nCount) == 0)
oDone.Set();
}

[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("usage: mah_dotnet.exe <count> \"<command>\"");
return;
}

sFilename = args[1];

for(int n = 2; n < args.Length; n++)
sArguments += string.Format("{0} ", args[n]);

oDone = new AutoResetEvent(false);

for(int n = 0; n < int.Parse(args[0]); n++)
{
ThreadStart oThreadStart = new ThreadStart(RunProcess);
Thread oThread = new Thread(oThreadStart);
oThread.Start();
}

oDone.WaitOne();
}

We haven't yet tried repairing or re-installing the 1.1 .NET Framework on
this machine, but thought this would be worth raising in the mean-time. Is
there anything else we can look at before we attempt the re-install of .NET?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top