Solved

Service App Shutting down

Posted on 2004-10-04
6
171 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connection between libmysql.dll and MySQL Versions 7 113
oracle global variables 4 76
CheckListBox usage 3 72
shape, triangle, dbctrlgrid 3 17
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 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