views:

20

answers:

1

In the past few weeks, to speed up our database freshening process, I've created a couple of extra programs, basically copies of the exe file. The program itself, accesses web pages, images etc and uses threads to do so. The second program uses LIMIT 300,100 and the third LIMIT 600,100, to make sure they don't work on the same records.

Before the last few weeks, one occurrence of the program used to run without problem, from the task scheduler all through the day. Only one occurrence of each exe can run at a time.

Since theres now three programs running, .net 2.0, on xp, the program often seems to get stuck and never ends. I have to kill it from task manager.

It runs fine in the IDE

I just wonder if there would be any benefit from upgrading to vb.net 2010 ?

+2  A: 

You've got a deadlock problem, so common in threaded code. VS2010 isn't magically going to make it disappear. There's a new class in .NET 4.0 called Task, it simplifies the job of managing threads. But is just as likely to suffer from deadlock if your original code is already triggering it. You could rewrite the code with tasks and get lucky. That kind of luck is usually short-lived, it will deadlock once a month instead of once an hour. Far worse since it is so much harder to troubleshoot.

Solve the problem first, consider improving it only after that. And the time you'll spent on chasing this problem is well worth it, you'll know a lot more about threading when you're done.

Hans Passant
Can you tell me more about how I should find and fix my problem ?
Jules
@Jules - that's a *very* different question and one you didn't nearly provide enough info for. You'll find lots of help when you search google or this website. Your keywords are +debug +deadlock. If that doesn't help then be sure to start a new question where you carefully describe the kind of code you're trying to run, well documented with snippets.
Hans Passant
OK, maybe this will be obvious... I think THIS may be the problem OpenFile = New FileStream(pstrFile, FileMode.Open, FileAccess.Read, FileShare.Read) , any suggestions ?
Jules
My crystal ball is saying http://tinyurl.com/so-hints
Hans Passant