Solved

Service App Shutting down

Posted on 2004-10-04
6
170 Views
Last Modified: 2010-04-05
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.
0
Comment
Question by:bjones8888
6 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12218010
use log files, trap the exceptions as (in the main procedures):

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
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12218350
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12218592
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.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 12

Accepted Solution

by:
Lee_Nover earned 500 total points
ID: 12219150
delphi's service implementation automaticaly logs exception in the Event log - can't remember if SvCom has this
I never liked SvCom anyway .. tried it once and had nothing but problems
instead of a normal timer use a threaded timer .. there are lots of those out there :) <- try this first :)
otherwise set the ExceptProc to your exception proc and handle the _unhandled_ exceptions there :)
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12221695
as Lee Nover said, Windows Services' events are written in Event Log

Start / Settings / Control Panel / Administrative Tools / Event Viewer
0
 

Author Comment

by:bjones8888
ID: 12385276
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.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question