Solved

Service App Shutting down

Posted on 2004-10-04
6
168 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now