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?
(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?