bjones8888
asked on
Service App Shutting down
I have created a service application using svCom and the code from Directory Monitor, using Delphi 6. It monitors changes to a directory tree and updates a full text search index. The directory monitoring seems to work ok. When the indexing fires off (based on a timer), the service shuts down - but only on some machines.
svCom allows me to run it in a debugger, but when I do that, it runs ok. When I run it as a true service on my development machine, it's ok. But when I run it on my server, it occasionally works, but most often shuts down. No error messages, since it's a service app.
How do I debug this thing? Is there anyone who is familiar enough with these components and is willing to debug my code? I'm happy to send along all the source and the text indexing dll.
svCom allows me to run it in a debugger, but when I do that, it runs ok. When I run it as a true service on my development machine, it's ok. But when I run it on my server, it occasionally works, but most often shuts down. No error messages, since it's a service app.
How do I debug this thing? Is there anyone who is familiar enough with these components and is willing to debug my code? I'm happy to send along all the source and the text indexing dll.
Just a wild guess... But I've been lucky at wild guesses. ;-)
I think it's a timer issue. I think the computers that crash the server respond to slow when the timer triggers. Perhaps it triggers too soon or not at all.
And of course, use lots and lots of logging. With services, WriteLn is your best friend.
I think it's a timer issue. I think the computers that crash the server respond to slow when the timer triggers. Perhaps it triggers too soon or not at all.
And of course, use lots and lots of logging. With services, WriteLn is your best friend.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
as Lee Nover said, Windows Services' events are written in Event Log
Start / Settings / Control Panel / Administrative Tools / Event Viewer
Start / Settings / Control Panel / Administrative Tools / Event Viewer
ASKER
Lee -- Thanks for the tips. The event log and the other types of timers led me to the solution. In this particular case, I broke the service down to the smallest necessary parts (only the directory monitor and the timer) and had it call a second program for the index updates.
try
except
on E:Exception do
WriteToErrorLog('Error in procedure X:'+E.Message)
end
for your internal procedures (and critical code), just do something like (these populate back to the main procedures, which write the full error to the log file):
try
except
on E:Exception do
raise Exception.Create('Error in process Y:'+E.Message)
end
that way you will gather very detailed errors and where exactly it ocurred