Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-07

LazDaemon

17 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

I think the LazDaemon package is broken at least on Windows. Can someone else start a Windows service made with it? I cannot.

There is an example project
C:\SW\lazarus_gitsvn\examples\cleandir\cleandirs.lpi that uses it. Trying to install it ("cleandirs.exe -i" with admin rights) fails. Same thing with any other project.

The log says:
Failed to start service manager: Palveluprosessi ei voi muodostaa yhteytt? palveluvalvontaan.

The latter sentence means something like:
Service process cannot connect to service manager.

I am able to install a Windows service made without LazDaemon following the instructions given in Micha?l Van Canneyt's document : http://www.turbog.com/wp-content/uploads/2012/04/daemons.pdf

Micha?l is also the author of LazDaemon package.
Could he maybe take a look at it?
There is a bug report but it lists other problems, not the complete failure when trying to install.
http://bugs.freepascal.org/view.php?id=24067

I am using Windows 7, FPC 2.6.4 and Lazarus trunk.

Juha

Reply by email

Virgo Pärna
to Juha Manninen
Juha Manninen wrote 8 lines
I think the LazDaemon package is broken at least on Windows. Can someone else start a Windows service made with it? I cannot. There is an example project C:\SW\lazarus_gitsvn\examples\cleandir\cleandirs.lpi that uses it. Trying to install it ("cleandirs.exe -i" with admin rights) fails. Same thing with any other project.

You are running that "cleandir.exe -i" form cmd Window? Did you start cmd with "Run as Administrator"?
I created a Windows service just resently with Lazarus and it works.

Virgo P?rna

Reply by email

Michael Van Canneyt
to Juha Manninen: I think the LazDaemon package is broken at least on Windows. Can someone else start a…
Juha Manninen wrote 14 lines
I think the LazDaemon package is broken at least on Windows. Can someone else start a Windows service made with it? I cannot. There is an example project C:\SW\lazarus_gitsvn\examples\cleandir\cleandirs.lpi that uses it. Trying to install it ("cleandirs.exe -i" with admin rights) fails. Same thing with any other project. The log says: Failed to start service manager: Palveluprosessi ei voi muodostaa yhteytt? palveluvalvontaan. The latter sentence means something like: Service process cannot connect to service manager.

That is usually a permissions problem.

Show quoted text 12 lines
I am able to install a Windows service made without LazDaemon following the instructions given in Micha?l Van Canneyt's document : http://www.turbog.com/wp-content/uploads/2012/04/daemons.pdf Micha?l is also the author of LazDaemon package. Could he maybe take a look at it? There is a bug report but it lists other problems, not the complete failure when trying to install. http://bugs.freepascal.org/view.php?id=24067 I am using Windows 7, FPC 2.6.4 and Lazarus trunk.

When I find some time, I will have a have successfully installed this program on windows, but it was a windows 2000. Maybe the permissions setup has changed in windows, this is always a possibility.

Michael.

Reply by email

Juha Manninen
to Virgo Pärna: You are running that "cleandir.exe -i" form cmd Window? Did you start cmd with "Run as…
Virgo P?rna wrote
You are running that "cleandir.exe -i" form cmd Window? Did you start cmd with "Run as Administrator"?

Yes. Actally the service version is "cleandirs.exe" (with "s"). There is also a cmd line program "cleandir.exe".

I created a Windows service just resently with Lazarus and it works.

Strange.
I believe it is a permissions problem but I have no idea how to fix it. I will use now the FPC daemon class, it works.

Juha

Reply by email

Michael Van Canneyt
to Juha Manninen
Juha Manninen wrote 12 lines
On Thu, Jul 24, 2014 at 4:10 PM, Virgo P?rna wrote: > You are running that "cleandir.exe -i" form cmd Window? Did you start cmd with > "Run as Administrator"? Yes. Actally the service version is "cleandirs.exe" (with "s"). There is also a cmd line program "cleandir.exe". > I created a Windows service just resently with Lazarus and it works. Strange. I believe it is a permissions problem but I have no idea how to fix it. I will use now the FPC daemon class, it works.

Out of curiosity: which class is that ?

Michael.

Reply by email

Juha Manninen
to Michael Van Canneyt
Michael Van Canneyt wrote
> I will use now the FPC daemon class, it works. Out of curiosity: which class is that ?

I mean the TCustomDaemon and TCustomDaemonMapper descendants as explained in your PDF, without using LazDaemon package. LazDaemon uses the same classes internally yet it does not work. Yes, it is strange.

Now, does anybody know how to debug Windows services?

Juha

Reply by email

Graeme Geldenhuys
to Juha Manninen
Juha Manninen wrote
Now, does anybody know how to debug Windows services?

tiOPF's tiLog.pas unit (and friends: tiLogToFile etc) works very well. It can be used independently with any project.

The FPC dbugintf unit should also work, but has some issues (sometimes missing events).

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Michael Van Canneyt
to Juha Manninen: On Fri, Jul 25, 2014 at 9:05 AM, Michael Van Canneyt I mean the TCustomDaemon and…
Juha Manninen wrote 12 lines
On Fri, Jul 25, 2014 at 9:05 AM, Michael Van Canneyt wrote: >> I will use now the FPC daemon class, it works. > > Out of curiosity: which class is that ? I mean the TCustomDaemon and TCustomDaemonMapper descendants as explained in your PDF, without using LazDaemon package. LazDaemon uses the same classes internally yet it does not work. Yes, it is strange. Now, does anybody know how to debug Windows services?

You can only do it by attaching to an external process. Start the service, and attach the debugger to it.

That obviously means that you will miss the startup code.

It's what I hate about windows services :(
Usually I make the program twice: once as a normal program (to debug) and once as a service.

Michael.

Reply by email

Virgo Pärna
to Juha Manninen: On Fri, Jul 25, 2014 at 9:05 AM, Michael Van Canneyt I mean the TCustomDaemon and…
Juha Manninen wrote 11 lines
On Fri, Jul 25, 2014 at 9:05 AM, Michael Van Canneyt wrote: >> I will use now the FPC daemon class, it works. > > Out of curiosity: which class is that ? I mean the TCustomDaemon and TCustomDaemonMapper descendants as explained in your PDF, without using LazDaemon package. LazDaemon uses the same classes internally yet it does not work. Yes, it is strange.

Now that I think of it, I actually did not use LazDaemon. It was brookframework daemon, that used TCustomDaemonApplication and TCustomDaemonMapper. But lazarus daemon also inherits from TCustomDaemonApplication.

Virgo P?rna

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 5 lines
On Fri, Jul 25, 2014 at 09:18:01AM +0300, Juha Manninen wrote: > Now, does anybody know how to debug Windows services? Under Delphi GUI or gdb console Attach the debugger to the running process. I don't know how to do from the Lazarus IDE.

Same. "Attach to Program" in the Run menu (at least on linux).

Michael.

Reply by email

Juha Manninen
to Marco van de Voort: Under Delphi GUI or gdb console Attach the debugger to the running process. I don't know…
Marco van de Voort wrote
Under Delphi GUI or gdb console Attach the debugger to the running process. I don't know how to do from the Lazarus IDE.

There is such option in Lazarus Run menu but it gives an error when connecting to a running service.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140725/2b1a6199/attachment.html>

Reply by email

Sven Barth
to Juha Manninen
"Juha Manninen" wrote
On Friday, July 25, 2014, Marco van de Voort wrote: > > Under Delphi GUI or gdb console Attach the debugger to the running

process.

> I don't know how to do from the Lazarus IDE. There is such option in Lazarus Run menu but it gives an error when

connecting to a running service.

If the service is running as Admin then the IDE needs to be started as Admin as well.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140725/8062e249/attachment.html>

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: You can only do it by attaching to an external process. Start the service, and attach the…
Michael Van Canneyt wrote
Usually I make the program twice: once as a normal program (to debug) and once as a service.

I thought that was normal programming practice. :) I've always done it like that (Windows and *nix). I think I learned that from Delphi 4 or 5 days.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: You can only do it by attaching to an external process. Start the service, and attach the…
Michael Van Canneyt wrote
You can only do it by attaching to an external process. Start the service, and attach the debugger to it. That obviously means that you will miss the startup code.

Further comments on this. You should be able to debug the startup code by using the same trick I use for debugging CGI applications.

-------[ forwarded message of mine from long ago ]------------ In Delphi it is a common way to debug CGI applications. You define an infinite loop in the CGI app. Execute the CGI app via the web browser. The infinite loop then gives you a chance to attach the Delphi debugger. You then modify the variable of the infinite loop so it exits the loop. You can then step through the CGI application like any normal GUI or Console app.
--------------[ end ]---------------------

This works with Lazarus too. But for Windows Services / Linux Daemons, I still prefer the two application approach. One being the non-visual app, and the other with a debug GUI.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Michael Schnell
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Further comments on this. You should be able to debug the startup code by using the same trick I use for debugging CGI applications.

Sounds like doable but feels like a nasty workaround.

If this method indeed is necessary due to the technical environment, maybe Lazarus could somehow be enhanced in order to automate the process (similar to remote debugging).

-Michael

Reply by email

vfclists .
to Michael Van Canneyt: That is usually a permissions problem. When I find some time, I will have a have…
Michael Van Canneyt wrote 17 lines
On Thu, 24 Jul 2014, Juha Manninen wrote: I think the LazDaemon package is broken at least on Windows. > Can someone else start a Windows service made with it? I cannot. > When I find some time, I will have a look at it. I have successfully installed this program on windows, but it was a windows 2000. Maybe the permissions setup has changed in windows, this is always a possibility.

LOL

Michael. --
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140901/f51828e5/attachment.html>

Reply by email