473,404 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

CPU usage max'd out in ".NET SystemEvents" thread

Hi,

We have an app which, every now and then, has very high CPU usage.
Profiling under perfmon shows it to be thread #3 which is running at >=95%.

I took a process dump and looked at thread #3 in WinDbg and it's a thread
called ".NET SystemEvents"
The stack trace looks like this :

0:003!ClrStack -all

Thread 3

ESP EIP

ESP/REG Object Name

0x08a3fc6c 0x7b240ce2 [DEFAULT] [hasThis] Void
Microsoft.Win32.SystemEvents.WindowThreadProc()

EDI 0x08a3fcc8 ESI 0x00000001 EBX 0x00000000 EDX 0x0000000a ECX
0x00000000

EAX 0x00000000 EBP 0x08a3fcd8 ESP 0x08a3fc6c EIP 0x7b240ce2

ESP/REG Object Name

0x8a3fc78 0x652daf4 Microsoft.Win32.SystemEvents

0x8a3fd64 0x79b7d2c8 System.Array

0x8a3fd68 0x79b7d2c8 System.Array

0x8a3fe14 0x79b7d2c8 System.Array

0x8a3fe18 0x79b7d2c8 System.Array

0x08a3fed8 0x791da717 [FRAME: GCFrame]
and sometimes looks like this (I took a few snapshots) :

Thread 3

ESP EIP

0x08a3fc4c 0x01d9ac94 [FRAME: NDirectMethodFrameStandalone] [DEFAULT]
Boolean Microsoft.Win32.UnsafeNativeMethods.PeekMessage(By Ref ValueClass
MSG,ValueClass System.Runtime.InteropServices.HandleRef,I4,I4,I4)

ESP/REG Object Name

0x08a3fc64 0x7b240cdd [DEFAULT] [hasThis] Void
Microsoft.Win32.SystemEvents.WindowThreadProc()

EDI 0x08a3fcc8 ESI 0x00000001 EBX 0x00000000 EDX 0x00000008 ECX
0x00000000

EAX 0x00000000 EBP 0x08a3fcd8 ESP 0x08a3fc64 EIP 0x7b240cdd

ESP/REG Object Name

0x8a3fc78 0x652daf4 Microsoft.Win32.SystemEvents

0x8a3fd64 0x79b7d2c8 System.Array

0x8a3fd68 0x79b7d2c8 System.Array

0x8a3fe14 0x79b7d2c8 System.Array

0x8a3fe18 0x79b7d2c8 System.Array

0x08a3fed8 0x791da717 [FRAME: GCFrame]
Can anyone suggest what's going on? When the app is restarted it behaves
normally - i.e. consumes virtual 0% CPU.

TVMIA,

- Adam.

==============================
Ad*********@Omnibus.NOSPAMMYSPAMSPAM.co.uk
Jun 20 '07 #1
4 3668
"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote in message
news:OU**************@TK2MSFTNGP02.phx.gbl...
Hi,

We have an app which, every now and then, has very high CPU usage.
Profiling under perfmon shows it to be thread #3 which is running at
>=95%.

I took a process dump and looked at thread #3 in WinDbg and it's a thread
called ".NET SystemEvents"
The stack trace looks like this :

0:003!ClrStack -all

Thread 3

ESP EIP

ESP/REG Object Name

0x08a3fc6c 0x7b240ce2 [DEFAULT] [hasThis] Void
Microsoft.Win32.SystemEvents.WindowThreadProc()

EDI 0x08a3fcc8 ESI 0x00000001 EBX 0x00000000 EDX 0x0000000a ECX
0x00000000

EAX 0x00000000 EBP 0x08a3fcd8 ESP 0x08a3fc6c EIP 0x7b240ce2

ESP/REG Object Name

0x8a3fc78 0x652daf4 Microsoft.Win32.SystemEvents

0x8a3fd64 0x79b7d2c8 System.Array

0x8a3fd68 0x79b7d2c8 System.Array

0x8a3fe14 0x79b7d2c8 System.Array

0x8a3fe18 0x79b7d2c8 System.Array

0x08a3fed8 0x791da717 [FRAME: GCFrame]
and sometimes looks like this (I took a few snapshots) :

Thread 3

ESP EIP

0x08a3fc4c 0x01d9ac94 [FRAME: NDirectMethodFrameStandalone] [DEFAULT]
Boolean Microsoft.Win32.UnsafeNativeMethods.PeekMessage(By Ref ValueClass
MSG,ValueClass System.Runtime.InteropServices.HandleRef,I4,I4,I4)

ESP/REG Object Name

0x08a3fc64 0x7b240cdd [DEFAULT] [hasThis] Void
Microsoft.Win32.SystemEvents.WindowThreadProc()

EDI 0x08a3fcc8 ESI 0x00000001 EBX 0x00000000 EDX 0x00000008 ECX
0x00000000

EAX 0x00000000 EBP 0x08a3fcd8 ESP 0x08a3fc64 EIP 0x7b240cdd

ESP/REG Object Name

0x8a3fc78 0x652daf4 Microsoft.Win32.SystemEvents

0x8a3fd64 0x79b7d2c8 System.Array

0x8a3fd68 0x79b7d2c8 System.Array

0x8a3fe14 0x79b7d2c8 System.Array

0x8a3fe18 0x79b7d2c8 System.Array

0x08a3fed8 0x791da717 [FRAME: GCFrame]
Can anyone suggest what's going on? When the app is restarted it behaves
normally - i.e. consumes virtual 0% CPU.

TVMIA,

- Adam.

==============================
Ad*********@Omnibus.NOSPAMMYSPAMSPAM.co.uk

It looks like you are creating/handling windows on another thread than the
main thread (thread 3). That could be because you are calling into COM on
this thread, or that you are creating Windows forms on this thread, or you
are calling DoEvents or ....
Anyway there is a message loop running in thread 3.
It's really hard to tell what's really happening here without some detailed
context or without seeing some code.

Willy.

Jun 20 '07 #2
It's really hard to tell what's really happening here without some
detailed context or without seeing some code.
Well in that thread none of our code is running, which is what was puzzling
me so much.

But your comments have given me a place to start looking - some of our
programmers, especially the juniors, are not that careful about only doing
UI work on the UI thread. I don't think there are any COM objects in that
particular app so I guess we'll have to comb it for windows, UI work outside
of thread 0. Sound like a reasonable plan of attack?

Thanks,

Adam.
==========
Jun 20 '07 #3
"Adam Benson" <Ad*********@NOSPAMMYSPAM.omnibus.co.ukwrote in message
news:up*************@TK2MSFTNGP02.phx.gbl...
>It's really hard to tell what's really happening here without some
detailed context or without seeing some code.

Well in that thread none of our code is running, which is what was
puzzling me so much.

But your comments have given me a place to start looking - some of our
programmers, especially the juniors, are not that careful about only doing
UI work on the UI thread. I don't think there are any COM objects in that
particular app so I guess we'll have to comb it for windows, UI work
outside of thread 0. Sound like a reasonable plan of attack?

Thanks,

Adam.
==========
I would not exclude COM, some components in the framework are just wrapping
some underlying COM components, I'm afraid this is the case here because the
thread seems to run an event handler for windows events.

Willy.

Jun 20 '07 #4
I think we got it - started looking at where that thread came from.

It was created when the app's main form was created and the first textbox
was created.
The cause - our main method was missing the [STAThread] attribute.

Hopefully, this will fix the issue.

====
Adam.
Jun 21 '07 #5

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

Similar topics

10
by: george young | last post by:
I had developed the habit of using the neat python form: if someinstance: someinstance.memb() because it seems cleaner than "if someinstance is not None". {please no flames about "is not None"...
0
by: Steve | last post by:
Hi, Is there something fundamentally wrong with the following query? SELECT MAX(OrderID) AS Expr1 FROM Orders WHERE (MarketActionCode = 'S') AND (OrderLegCode = 'S') AND (Status = 'F') AND...
1
by: PeteCresswell | last post by:
I'm working on a new report in an MS Access DB. The first anomaly was a message "This action will reset the current code in break mode." when the report was run. Seems TB something about my...
3
by: Serious_Practitioner | last post by:
Good day, and thank you in advance for any assistance you can provide. I have a table in an Access 2000 .mdb file, and I've run into something odd and insolvable, at least for me. The database is...
8
by: abcd | last post by:
I can get the value on the form at the server side by using Request.form("max") when max field is disabled I dont get value. For GUI and business logic purpose I have disabled some fields with...
9
by: schuetz | last post by:
Hi @ll, I'm working on a web project which has to use multiple channels to connect to receive several sources at once. The problem is, that I'm not aware of the maximum amount of Threads i can...
4
by: Niron kag | last post by:
Hi, I have a windows service, which is currently installed, on my local computer. The problem is that when I look at the task manager, I see that the “Mem Usage”, become bigger and bigger....
10
by: JDT | last post by:
Hi, Can someone provide me an example that uses std::max_element() (probablly the predicate version) to return the max "absolute" integer in a vector? Your help is much appreciated. Tony ...
10
by: anonymous | last post by:
How can I set report output parameter "Page 1 of max" to get output on first page in minimum time as it takes much time in fetching max page no. in first page and report is of around million pages
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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

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