473,800 Members | 2,613 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service grinding to a hault

JJ
I have written a multi-threaded Windows service. I developed it in such a way that the core logic is a separate class library from the actual service project, so I could test the .DLL in a console. In the console test app, the app will run for days on end without a problem. All necessary calls are thread safe (lock). However, when plugged into the Windows service, the darn thing simply grinds to a halt i a matter of minutes. No exceptions, no logging, nothing.

A processing thread is manually spawned that polls a DB every so often. the information obtained from the db is then queued up in another thread that is spawned manually. I manually create the threads since these processes can run for several minutes each. I internally manage the number of threads created and limit it to a set amount. If max number of thread are running, it waits until a thread dies, then launches itself. I was using the ThreadPool, but thought that I maybe having conflicts and ldead-locking since I do my I/O asynchronously delegate calls - that being why I create the threads manually (I read in an article by John Skeet that the ThreadPool should only be used for short lived processes, and that it is used by async delegate calls). If anybody can point me in the right direction on getting this thing to run, it would be greatly appreciated.
Nov 16 '05 #1
2 1596
There's a free utility called cslint that I've come across for detecting
deadlocks in C# apps.
You can get it at:
http://www.garret.ru/~knizhnik/lang.html
(scroll down for cslint)

There's some other utilities there of interest too.

Hope that helps. Deadlocks are evil.

"JJ" <JJ@discussions .microsoft.com> wrote in message
news:D1******** *************** ***********@mic rosoft.com...
I have written a multi-threaded Windows service. I developed it in such a way that the core logic is a separate class library from the actual service
project, so I could test the .DLL in a console. In the console test app,
the app will run for days on end without a problem. All necessary calls are
thread safe (lock). However, when plugged into the Windows service, the
darn thing simply grinds to a halt i a matter of minutes. No exceptions, no
logging, nothing.
A processing thread is manually spawned that polls a DB every so often.

the information obtained from the db is then queued up in another thread
that is spawned manually. I manually create the threads since these
processes can run for several minutes each. I internally manage the number
of threads created and limit it to a set amount. If max number of thread
are running, it waits until a thread dies, then launches itself. I was
using the ThreadPool, but thought that I maybe having conflicts and
ldead-locking since I do my I/O asynchronously delegate calls - that being
why I create the threads manually (I read in an article by John Skeet that
the ThreadPool should only be used for short lived processes, and that it is
used by async delegate calls). If anybody can point me in the right
direction on getting this thing to run, it would be greatly appreciated.
Nov 16 '05 #2
JJ <JJ@discussions .microsoft.com> wrote:
I have written a multi-threaded Windows service. I developed it in
such a way that the core logic is a separate class library from the
actual service project, so I could test the .DLL in a console. In the
console test app, the app will run for days on end without a problem.
All necessary calls are thread safe (lock). However, when plugged
into the Windows service, the darn thing simply grinds to a halt i a
matter of minutes. No exceptions, no logging, nothing.
Can you run as a Windows service under the debugger, and see where it's
locking up? Alternatively, can you add *loads* of logging to get at the
problem that way?
A processing thread is manually spawned that polls a DB every so
often. the information obtained from the db is then queued up in
another thread that is spawned manually. I manually create the
threads since these processes can run for several minutes each. I
internally manage the number of threads created and limit it to a set
amount. If max number of thread are running, it waits until a thread
dies, then launches itself. I was using the ThreadPool, but thought
that I maybe having conflicts and ldead-locking since I do my I/O
asynchronously delegate calls - that being why I create the threads
manually (I read in an article by John Skeet that the ThreadPool should
only be used for short lived processes, and that it is used by async
delegate calls). If anybody can point me in the right direction on
getting this thing to run, it would be greatly appreciated.


Apart from the above, I'd suggest copying the whole solution and then
removing bits left, right and centre until you've got a small program
which still displays the symptoms. The problem will either be obvious,
or you'll have it in a form which is suitable for posting by that
stage.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

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

Similar topics

3
1779
by: Geoff Caplan | last post by:
Hi folks, Enjoying the process of picking up Python, but have come to an unexpected grinding halt. I am using the latest ActivePython release on Win2k. When I try to run python setup.py install on a disutil package, I get the error:
11
2268
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
9
7273
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service stopping. Please advise how to stop the service. Thanks, SP
1
3455
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm going wrong. The program has been written to do the following tasks: - Select remote server - Select from two specific services
0
3943
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server - Select from two specific services - Check the status of the server
0
3629
by: Barb | last post by:
Hello, I have a (C#) web service being consumed by a high volume "asp classic" site. It worked perfectly until I tried consuming a second web service from the first web service. Both services are very high-performing on their own, make inexpensive database calls and use good caching to avoid excess database hits. However, when service 1 makes a call to service 2, I get several timeout errors per minute (error is "The operation has...
4
4186
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 check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
5
3311
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
1
2090
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding, endpoint etc. programmatically in the Program.cs file. Any idea what I might be doing wrong? Cheers,
0
9691
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
10507
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...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
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,...
0
6815
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
5473
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
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
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
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.