views:

610

answers:

2

I have a C# 2.0 windows service (100% managed code) and occasionally when it is started/restarted it causes the entire machine (Windows Server 2003) to hang indefinitely. When I click “Start the service” the service control progress bar gets halfway then the machine becomes completely unresponsive at the local terminal and remote desktop sessions. The only solution is to restart the machine.

There is nothing in the system event log.

The service is a Remoting server that on start up makes Remoting calls to other Remoting servers (also windows services) over TCP.

At first I was thinking this maybe a network card issue so we replaced the machine (better spec, different network card) but I still get the same issue in about 1 in 10 restarts …. so 90% of time it is completely fine.

What am I doing wrong?

A: 

Add logging code to the service's onStart routine. You should be able to figure out which function calls are spiking your CPU, and work from there.

GWLlosa
A: 

It's a bug in your code! Perhaps post a cut down version.

As suggested by @GWLlosa, add copious logging.

Mitch Wheat
I thought managed code couldn’t crash a machine?
It can't crash the machine, but it can certainly consume all its resources, deadlock horribly, and stall it out, giving it every appearance of a crash.
GWLlosa