473,395 Members | 1,870 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,395 software developers and data experts.

Long Running Operations Windows Forms

86
So I'm working on a Windows Forms for VB.NET in VS 2005 that is highly computational. It gets a ton of data from a database and eventually spits out a report based on the data. Because of the time it takes to run, when I debug I get the following message:

"The CLR has been unable to transition from COM context 0x1a01b0 to COM context 0x1a0320 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."

Any advice on how to handle this situation? I've tried to make my code as efficient as possible, so I'm going to have to deal with these long periods of computation.

Thanks.
Feb 20 '07 #1
6 2050
kenobewan
4,871 Expert 4TB
IMO - web designers are smarter with handling large files than we web/ windows developers are with data. What do I mean? They think about what they can preload to the browser and what can happen later.

Can't comment on your particular case Enreil, but some developers use SQL queries that are too general and try to manage all of the data at once instead of 'packets'. I guess my suggestion is that it is great that you have optimized your code - have you optimized your queries? Database design and optimized queries are important for the transition from medium to large applications.
My two cents worth...

Of course if you have already got a good database design and well structured queries, then you may want to look at managing your threads.
Feb 21 '07 #2
enreil
86
Thanks for your thoughts. My SQL queries are pretty basic select statements, so I don't know that there's a whole lot of optimization I can do in that regard. The real holdup in this project is the DB access time. The DB is located several time zones away and it just takes a long time to go there and bring the data back. I'm working with tens of thousands of rows of data, so I try to mitigate the overhead caused by the long DB trips by grabbing all of the data I need in one trip, stashing it in memory, and thenselecting what I need from there. I didn't research this tactic, but it seemed logical. The alternative is to make multiple trips to get the specific data I need, so while my SQL queries would runs faster by pulling less data, the time to get there and back makes that an undesirable approach.

Anyways, I'll look into better thread management and see where that takes me. Appreciate the feedback.
Feb 21 '07 #3
kenobewan
4,871 Expert 4TB
Any progress using thread management?
Feb 23 '07 #4
enreil
86
Thanks for asking. Yes, improving thread management gets rid of the error - I just added the line

System.Threading.Thread.CurrentThread.Join(1)

at appropriate places in my code. It'll do for now. Looking back at my code, I think there is still room to make my code more efficient, but right now I just need the app to do its job. Thanks for your assistance!

Any progress using thread management?
Feb 23 '07 #5
AricC
1,892 Expert 1GB
Thanks for your thoughts. My SQL queries are pretty basic select statements, so I don't know that there's a whole lot of optimization I can do in that regard. The real holdup in this project is the DB access time. The DB is located several time zones away and it just takes a long time to go there and bring the data back. I'm working with tens of thousands of rows of data, so I try to mitigate the overhead caused by the long DB trips by grabbing all of the data I need in one trip, stashing it in memory, and thenselecting what I need from there. I didn't research this tactic, but it seemed logical. The alternative is to make multiple trips to get the specific data I need, so while my SQL queries would runs faster by pulling less data, the time to get there and back makes that an undesirable approach.

Anyways, I'll look into better thread management and see where that takes me. Appreciate the feedback.
What kind of connection do you have between the two sites?
Feb 23 '07 #6
enreil
86
Between my app and the DB? The DB is Oracle, and I'm just using a basic Oracle connection string with the Datasource, username, and password. Is that what you're getting at?

What kind of connection do you have between the two sites?
Feb 23 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid,...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
2
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the...
0
by: Slawomir Nasiadka | last post by:
Hi, I'am new to this group so I would like to say "Hello" everyone and here is my problem: I'm writing a simple application (code is at the end of this message) witch would list all mails...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
9
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my...
4
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request...
3
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
My application is taking way too long to build. It use to never take so long. I change only line and I think it recompiles all the classes in the assembly because it hangs forever. Here is the...
2
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.