J
Jon Skeet [C# MVP]
Thought I'd throw this out and see if anyone's seen anything similar.
I have a Windows service written in C#, which occasionally stops
silently. The process goes away, Windows notices and shows it as
unstarted in the service control manager.
This always happens (as far as we've seen) after another specific kind
of error (an external resource being unavailable), but the time between
the previous error and the service failing can be hours. The previous
error is logged nicely, but there's nothing in the log just before the
service dies.
I've tried reproducing this by writing deliberately bad code, and seen
the following:
1) An exception in a finalizer is logged (not by our code; it's logged
as a CLR error, effectively)
2) Throwing an exception is logged by our infrastructure code
3) Running out of memory just throws an exception
4) Calling Environment.Exit reproduces the behaviour - but we don't
have that in our code.
The only feasible explanation I currently have is that some buggy
third-party library code has a call to Environment.Exit in it - but
that seems pretty unlikely, and doesn't properly explain the time
delay, unless it's occurring in a finalizer which somehow didn't get
executed for over 4 hours in one case (gen 2 is feasible, I guess).
Anyone seen anything like this? Hints? Oh, by the way I can't reproduce
this on a test system... ;(
I have a Windows service written in C#, which occasionally stops
silently. The process goes away, Windows notices and shows it as
unstarted in the service control manager.
This always happens (as far as we've seen) after another specific kind
of error (an external resource being unavailable), but the time between
the previous error and the service failing can be hours. The previous
error is logged nicely, but there's nothing in the log just before the
service dies.
I've tried reproducing this by writing deliberately bad code, and seen
the following:
1) An exception in a finalizer is logged (not by our code; it's logged
as a CLR error, effectively)
2) Throwing an exception is logged by our infrastructure code
3) Running out of memory just throws an exception
4) Calling Environment.Exit reproduces the behaviour - but we don't
have that in our code.
The only feasible explanation I currently have is that some buggy
third-party library code has a call to Environment.Exit in it - but
that seems pretty unlikely, and doesn't properly explain the time
delay, unless it's occurring in a finalizer which somehow didn't get
executed for over 4 hours in one case (gen 2 is feasible, I guess).
Anyone seen anything like this? Hints? Oh, by the way I can't reproduce
this on a test system... ;(