Re: Indy in service-mode

Giganews Newsgroups
Subject: Re: Indy in service-mode
Posted by:  Giuliano (bidoneaspiratut…
Date: Tue, 10 May 2011

Il Tue, 10 May 2011 18:05:20 +0200, "Andreas Bartusch" <abartus…> ha scritto:

>we have got a server-application with heavy use of Indy for TCP and
>At the moment we are looking into an issue, where our application randomly
>crashes while active. There seems to be a connection to the windows
>service mode, because as service these crashes appear more often. The
>error is hard to reproduce, it may happen after a few minutes but on other
>machines it runs without any problems.
>It is not yet clear if Indy is the reason for that at all, but perhaps u
>have an idea or know about similar issues related to Indy (as windows
>service / special settings for high load / combination of tcp and http in
>one application) that could help us.

Hi Andreas,

    I've used indy many times in the past to build windows services, using the
most popular protocols, both client and server, like SMTP, HTTP, TCP, UDP, etc ...
and I haven't experimented any problem.
Also I've used the IdHTTPWebBrokerBridge.pas unit to build a stand alone Web Service
as Windows Service that operates uninterrupted and correctly for months without
crashing not even once. Moreover using C++.

My suggestion is you have to build a robust logging infrastructure when you are dealing
with windows services, in order to have the possibility to make (at least) a decent,
although tedious, post mortem analisys.
Is strongly reccomended you use the Windows Event Log, maybe creating a separate DLL
with messages you can generate with the Microsoft message compiler (mc.exe).

Another chance is to directly debug the service itself. A way is to write a application
that mimics the SMC, driving your service like it was a real service. Doing so you are
able to debug the code as if it is a normal desktop application. The main disadvantage
of this approach is that the program not runs with the system's credentials (i.e. it can
behave differently respect a real service).
If you want to try to debug the service as a real service, you have to use a old S.O.
like XP that runs services in the same session of your debugger, otherwise -
AFAIK - is impossible, for the debugger, to put the hands on the running service
trying to attach themselves to it (for sake of security rules on new OSes).

Good luck.





In response to

Indy in service-mode posted by Andreas Bartusch on Tue, 10 May 2011