App gives error on mutiple CPU machine

  • Thread starter Thread starter Shashank Welankar
  • Start date Start date
S

Shashank Welankar

Hi,

"System.Diagnostics.Process.GetCurrentProcess().Thread.Count"

This does not work on the machine with mutiple CPU? Any hints from MS guys?

Shashank
 
It's Threads, not Thread -- that'd make a difference :).

Anyways, I tried this our on my "dual" processor (a HyperThreaded P4) and it
worked fine. Can you provide more information? What do you mean by "it
does not work"?

-mike
MVP
 
Hi,

This is the error we get...

Its on .NET version 1.1.4322.573, Windows 2000 Server machine

Hardware is

2 x 1GHz CPU
1GB RAM
2 x 18 GB HD
Windows 2000 server sp4 with current HotFixes >>MSSQL 2000 SP3a with
current HotFixes

System.InvalidOperationException: Couldn''t get process information from
remote machine. ---> System.ArgumentOutOfRangeException: Ticks must be
between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
at System.DateTime..ctor(Int64 ticks)
at System.DateTime.Subtract(TimeSpan value)
at System.Diagnostics.NtProcessManager.GetThreadInfo(PERF_OBJECT_TYPE
type, IntPtr instancePtr, PERF_COUNTER_DEFINITION[] counters)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library, Int32 processIndex, Int32 threadIndex, IntPtr dataBlockPtr)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
--- End of inner exception stack trace ---
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
at System.Diagnostics.NtProcessManager.GetProcessInfos(String
machineName, Boolean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos(String
machineName)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_Threads()





This is the code

Dim op As System.Diagnostics.Process =
System.Diagnostics.Process.GetCurrentProcess()
MsgBox(op.Threads.Count)



Thanks,
Shashank
 
What's the execution scenario? (Remoting or something?)

If you make a new console application and just do
Console.WriteLine(System.Diagnostics.Process.GetCurrentProcess().Threads.Cou
nt.ToString());, what happens?

-mike
MVP
 
Weird, It turns out that DateTime is constructed with an invalid value for Ticks.
I guess you run this from an asp.net application using the server version of the CLR. I would suggest you try this from a very
simple console application.

Willy.
 
Hi,

I just created a Windows application and copied the 2 statelemts in the
Sub Main

////////////////////Code
Public Sub main()
Try

System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = New
System.IntPtr(1)
Dim op As System.Diagnostics.Process =
System.Diagnostics.Process.GetCurrentProcess()
MsgBox(op.Threads.Count)
Catch err As Exception
MsgBox(err.ToString)
End Try
End Sub

////////////////////Exception


OPROCESSOR

System.InvalidOperationException: Couldn''t get process information from
remote machine. ---> System.ArgumentOutOfRangeException: Ticks must be
between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
at System.DateTime..ctor(Int64 ticks)
at System.DateTime.Subtract(TimeSpan value)
at System.Diagnostics.NtProcessManager.GetThreadInfo(PERF_OBJECT_TYPE
type, IntPtr instancePtr, PERF_COUNTER_DEFINITION[] counters)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library, Int32 processIndex, Int32 threadIndex, IntPtr dataBlockPtr)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
--- End of inner exception stack trace ---
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
at System.Diagnostics.NtProcessManager.GetProcessInfos(String
machineName, Boolean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos(String
machineName)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_Threads()


/////////////Configuration
Server configuration is following: >> >>2 x 1GHz CPU >>1GB RAM >>2 x 18
GB HD >> >>Windows 2000 server sp4 with current HotFixes >>MSSQL 2000
SP3a with current HotFixes >>Terminal Services in Application mode


/////////Details.
It is a fresh Windows 2000 Machine and yes we tried executing this both
from remote desktop and as it didn't work so also lcoally. It it simply
doesn't work.

Are there any hardware compatibility issues

Thanks,
Shashank
 
same behaviour.

No difference if I remove it. I actuallay added the affinity to solve the
bug.

Thanks
Shashank
Dave said:
Why are you setting the processor affinity? What happens if you remove that
statement.

Shashank Welankar said:
Hi,

I just created a Windows application and copied the 2 statelemts in the
Sub Main

////////////////////Code
Public Sub main()
Try

System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = New
System.IntPtr(1)
Dim op As System.Diagnostics.Process =
System.Diagnostics.Process.GetCurrentProcess()
MsgBox(op.Threads.Count)
Catch err As Exception
MsgBox(err.ToString)
End Try
End Sub

////////////////////Exception


OPROCESSOR

System.InvalidOperationException: Couldn''t get process information from
remote machine. ---> System.ArgumentOutOfRangeException: Ticks must be
between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
at System.DateTime..ctor(Int64 ticks)
at System.DateTime.Subtract(TimeSpan value)
at System.Diagnostics.NtProcessManager.GetThreadInfo(PERF_OBJECT_TYPE
type, IntPtr instancePtr, PERF_COUNTER_DEFINITION[] counters)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library, Int32 processIndex, Int32 threadIndex, IntPtr dataBlockPtr)
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
--- End of inner exception stack trace ---
at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
at System.Diagnostics.NtProcessManager.GetProcessInfos(String
machineName, Boolean isRemoteMachine)
at System.Diagnostics.ProcessManager.GetProcessInfos(String
machineName)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_Threads()


/////////////Configuration
Server configuration is following: >> >>2 x 1GHz CPU >>1GB RAM >>2 x 18
GB HD >> >>Windows 2000 server sp4 with current HotFixes >>MSSQL 2000
SP3a with current HotFixes >>Terminal Services in Application mode


/////////Details.
It is a fresh Windows 2000 Machine and yes we tried executing this both
from remote desktop and as it didn't work so also lcoally. It it simply
doesn't work.

Are there any hardware compatibility issues

Thanks,
Shashank
 
Back
Top