473,657 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UI not responding

I have a UI thread not responding also.

I have an Async operation that I am processing a long running SQL script
in ADO.Net. I am executing the Command asynchronous and hooking the
SqlCommand.Stat ementCompleted. I then use AsyncOperation to post events
back to the UI thread. The UI thread then updates a progress bar and
multi-line textbox. I then send a Windows Message to auto scroll the
textbox to the bottom. When the script stops running the UI comes back
to life.

The problem:
Sometimes when the user scrolls the textbox the UI thread locks-up.

What I’ve tried:
I have done extensive testing on my Async class on the execution path,
events and the logic.
The trace statements show the events firing, and being fully handled.
I tried commenting out the auto scroll, but that did not fix it.

What I think the problem is:
Honestly I don’t know.
The trace statements show everything is working correctly and executing
on the correct thread.

Is it possible to overload the application with too many events so the
UI can’t update?

The size of the project makes it very difficult in posting some examples
(Main form 900loc, SQL processor 800loc & Async base 500loc). So I am
just looking for some ideas on how to fix this problem.

Thanks
sprayer

*** Sent via Developersdex http://www.developersdex.com ***
Jun 7 '06 #1
6 4114
My advice is to create a small app and attempt to recreate the issue.
It doesn't sound like it would be too difficult and it would make it
much easier for us (you included) to diagnose the problem.
sprayer wrote:
I have a UI thread not responding also.

I have an Async operation that I am processing a long running SQL script
in ADO.Net. I am executing the Command asynchronous and hooking the
SqlCommand.Stat ementCompleted. I then use AsyncOperation to post events
back to the UI thread. The UI thread then updates a progress bar and
multi-line textbox. I then send a Windows Message to auto scroll the
textbox to the bottom. When the script stops running the UI comes back
to life.

The problem:
Sometimes when the user scrolls the textbox the UI thread locks-up.

What I've tried:
I have done extensive testing on my Async class on the execution path,
events and the logic.
The trace statements show the events firing, and being fully handled.
I tried commenting out the auto scroll, but that did not fix it.

What I think the problem is:
Honestly I don't know.
The trace statements show everything is working correctly and executing
on the correct thread.

Is it possible to overload the application with too many events so the
UI can't update?

The size of the project makes it very difficult in posting some examples
(Main form 900loc, SQL processor 800loc & Async base 500loc). So I am
just looking for some ideas on how to fix this problem.

Thanks
sprayer

*** Sent via Developersdex http://www.developersdex.com ***


Jun 7 '06 #2
Ya am able to reproduce the freeze regularly now. I made a SQL script
that affects ~8000 rows individually. This produced 8000 events to be
raised back to the main UI thread to handle (This is an extreme case,
but it reproduces the error). So I am sending so many events back to
the main UI thread its bogging it down.

What is the best practice for high throughput & chatty asynchronous
process?

I’m using “System.Compone ntModel.AsyncOp eration.Post()” to raise the
events on the UI thread. So I am thinking to not use AsyncOperation and
post the event on the asynchronous thread and then switch to the UI
thread only to update the user controls. Not sure but I think I will
have the same problem.

Thanks for the reply
sprayer
MCAD.NET
*** Sent via Developersdex http://www.developersdex.com ***
Jun 8 '06 #3
A trick you can use here is to batch the updates at the UI; set a timer
going when you start the async work, and stop it when it completes; when you
get the events, chuck the "updates" (in some form) into a collection
(remembering to lock it first); when the (slower) timer-tick fires [on the
UI thread], lock the same collection and read the "updates" into an array,
then clear the collection and unlock it; (this allows the events to keep
going while you update the UI); now loop through the collection of "updates"
and fix the UI, ideally using BeginUpdate/EndUpdate, SuspendLayout and
ResumeLayout to maximise throughput.

Oh - and remember a final sweep of the collection after stopping the timer
(after the async has ended).

That any help?

Marc
Jun 8 '06 #4
oh - and by "updates" I meant the vague term of whatever it is you need to
know... perhaps the specific event-type, sender and event-args on a holding
class?

Marc
Jun 8 '06 #5
The best practice is to increase the interval at which you report
progress. Does your client really need to know when .01% of the work is
done? Probably not.

sprayer wrote:
Ya am able to reproduce the freeze regularly now. I made a SQL script
that affects ~8000 rows individually. This produced 8000 events to be
raised back to the main UI thread to handle (This is an extreme case,
but it reproduces the error). So I am sending so many events back to
the main UI thread its bogging it down.

What is the best practice for high throughput & chatty asynchronous
process?

I'm using "System.Compone ntModel.AsyncOp eration.Post()" to raise the
events on the UI thread. So I am thinking to not use AsyncOperation and
post the event on the asynchronous thread and then switch to the UI
thread only to update the user controls. Not sure but I think I will
have the same problem.

Thanks for the reply
sprayer
MCAD.NET
*** Sent via Developersdex http://www.developersdex.com ***


Jun 8 '06 #6
If you run a task that updates the UI at such a high frequency, there is no
reason to run it on a separate thread, unless you run this on a SMP or
multi-core. Just run the task on the UI thread, this saves you from burning
a mass of CPU cycles only to marshal the update to the UI thread.

Willy.

"sprayer" <an*******@devd ex.com> wrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
| Ya am able to reproduce the freeze regularly now. I made a SQL script
| that affects ~8000 rows individually. This produced 8000 events to be
| raised back to the main UI thread to handle (This is an extreme case,
| but it reproduces the error). So I am sending so many events back to
| the main UI thread its bogging it down.
|
| What is the best practice for high throughput & chatty asynchronous
| process?
|
| I'm using "System.Compone ntModel.AsyncOp eration.Post()" to raise the
| events on the UI thread. So I am thinking to not use AsyncOperation and
| post the event on the asynchronous thread and then switch to the UI
| thread only to update the user controls. Not sure but I think I will
| have the same problem.
|
| Thanks for the reply
| sprayer
| MCAD.NET
|
|
| *** Sent via Developersdex http://www.developersdex.com ***
Jun 8 '06 #7

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

Similar topics

0
1113
by: Raghul | last post by:
hi I am working in making a jabber client.I made upto chatting with each other.Any number of people can be simultaneously chat.My problem is that If I am initiated to talk then the application works fine.Suppose if my friend initiate the session by sending message the window goes on not responding. What i done is that i used a class named dialog for chat window.When i dble click on the roster list the window is opened and can continue...
2
2372
by: Jonathan | last post by:
Running IIS 5.0. Running both .NET and ASP pages. Every several weeks all the ASP pages stop responding. Nothing is displayed. No events show up in event logs showing that the server is having problems. .NET and static HTML pages continue to respond. Restarting the world wide web publishing service gets the asp pages responding again. Any thoughts as to what is going on?
0
2317
by: Michael Bourgon | last post by:
I've been having the same problem for 2 weeks now. If anyone has any ideas, I'd love to hear them. We are using both SQL and Windows Authentication. I was running a Profiler Trace at the time, and am going through it now but have not seen anything yet. Thanks in advance. About once a week, at no fixed time (but so far, between 8am and 11am), my SQL Server 2000 on Windows 2000 (8.00.679) will stop responding. New connections will...
13
14595
by: long5120 | last post by:
I am trying to use webpage with javascript to check if a web server is responding. I was thinking of using 2 frames. Frame1 will have the site, and the Frame2 will be a status bar (not really needed). This webpage will call the site's homepage and refresh in 10 seconds. If I can see the homepage then, the site is up, else site is down. I have an example of my code below. My question, is it possible to check the homepage in frame1 (after...
2
4148
by: Nils Hedström | last post by:
Today my stateserver (running at the same computer at the web-server) suddenly stopped responding (after 10 days working perfectly). I did not see any entry in the eventlog indicating that the service stopped responding. This is the entry in web.config --- <sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="20"/>
4
13177
by: VB Programmer | last post by:
When I run my ASP.NET 2.0 web app on my dev machine it works perfect. When I precomile it to my web deployment project and then copy the debug files to my web server I get this problem when trying to login (obviously it's using ASPNETDB.mdf). Any ideas? Server Error in '/' Application. --------------------------------------------------------------------------------
1
45161
by: Ron | last post by:
Hi, I had a stored procedure on SQL 2000 server to run calculation with large amount of data. When I called this stored procedure via System.Data.SqlClient.SqlCommand on production, i got error as: (i tried to run the stored procedure on query analyzer, and it works well) Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred...
0
841
by: hellboss | last post by:
Hi ! Im working with asp.net, I have a Update Panel(Ajax tool) where two text boxes are placed and in Text box 1, i enter the Email and the max length for the field is set to 75. and another text box contain the phone no The system is not responding (Script is not responding)when i enter the email and leaving the last (75th) letter as a blank space and Hit the tab button. What actually should happen is it should move the next textbox ...
18
3239
by: rdahlstrom | last post by:
Does anyone know how to determine the window status (Running or Not Responding)? I've tried various methods with no success... This would be on a variety of Windows systems, but all at least XP, and mostly server 2003. Everyone will have Python 2.5.1 on them, and the script would be running locally. Any ideas?
7
1987
by: mills.toby | last post by:
We have a Windows 2003 Server, serving an asp.net (2.0) website. Recently the website stopped responding. When trying to access the website, no response is received at all. This includes when browsing the website from the local machine. While investigating the problem, we added a second copy of the website, created a second virtual directory in IIS, tried to access it, and it worked. The original website was still not responding. ...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.