* * *

Author Topic: Windows10 Daemon start is timing out  (Read 1244 times)

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Windows10 Daemon start is timing out
« on: July 10, 2018, 01:21:05 pm »
When I start a process in windows10 services I get timeout message on the start up (it seems win10 has 3000ms timeout limit on response to start command), works ok on XP though, I don't think I'm doing anything that would delay start up, maybe response message not getting through to win services?..any ideas?

Thaddy

  • Hero Member
  • *****
  • Posts: 6754
Re: Windows10 Daemon start is timing out
« Reply #1 on: July 10, 2018, 01:37:55 pm »
Services (windows daemons if you will) likely require a proper manifest file or resource. Is that in place?
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #2 on: July 10, 2018, 01:54:10 pm »
Ok thanks for the tip, will try creating and testing with manifest

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #3 on: July 10, 2018, 04:27:22 pm »
More info,..

I forgot to mention that when I ran the daemon with install -i it worked on XP, but on the win10 machine it didn't show up. We tried using sc.exe on win10 to register it and then it showed up in services window, but starting it gives the error. I found a link in stack overlfow that states that the timeout error can occur if you use sc.exe to register a service that is missing ServiceMain
https://stackoverflow.com/questions/3582108/create-windows-service-from-executable

Any idea why the -i option didn't make the service appear in win10 servies window (I did remember to refresh)

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 451
    • Lebeau Software
Re: Windows10 Daemon start is timing out
« Reply #4 on: July 11, 2018, 12:13:10 am »
When I start a process in windows10 services I get timeout message on the start up (it seems win10 has 3000ms timeout limit on response to start command), works ok on XP though, I don't think I'm doing anything that would delay start up, maybe response message not getting through to win services?..any ideas?

That is really hard to answer without seeing your actual service code.

Services (windows daemons if you will) likely require a proper manifest file or resource. Is that in place?

Services don't need or use manifests just to be able to install/run.

Any idea why the -i option didn't make the service appear in win10 servies window (I did remember to refresh)

Were you running it from an elevated command prompt so it could install using admin rights?
« Last Edit: July 11, 2018, 12:15:09 am by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #5 on: July 11, 2018, 01:19:18 pm »
That is really hard to answer without seeing your actual service code.
I'll get a copy, clean and upload..

Were you running it from an elevated command prompt so it could install using admin rights?
..it wasn't me at the keyboard so don't know what the environment at the time was..I did notice the cmd window had the administrator title in the caption at the top so assumed admin rights..would that be ok?

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 451
    • Lebeau Software
Re: Windows10 Daemon start is timing out
« Reply #6 on: July 12, 2018, 01:07:40 am »
I did notice the cmd window had the administrator title in the caption at the top so assumed admin rights..would that be ok?

Yes.  That caption appears only when the command window is started with elevated rights.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #7 on: July 12, 2018, 01:25:04 am »
Thanks, sorry for delay getting source code uploaded, I have attached project that works on XP for me.

Will try on Win10 when I can get access to machine in morning.

The example is a minimum demo, it just beeps every 3 seconds..
It has readme and a couple of batch files to register/un-register

If the example works and anyone suggests tidying it up for others to use then I'm happy to do that..

Mike

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #8 on: July 12, 2018, 01:51:16 pm »
I have uploaded new zip with updated batch files for register/un-register (they were empty)

I have had some feedback on this,

1. The service does install on Win10
2. The service does Start (shows as running, stop button becomes enabled)

but no beep from the service, I'm using lazarus beep command, any reason why this might not work in a service in Win10, I get beeps on XP

GetMem

  • Hero Member
  • *****
  • Posts: 3161
Re: Windows10 Daemon start is timing out
« Reply #9 on: July 12, 2018, 02:10:59 pm »
Quote
but no beep from the service, I'm using lazarus beep command, any reason why this might not work in a service in Win10
From vista+ services run in a different session(0). You cannot interact with the desktop(speaker included), however you can create/open/read/write file(s). If you need an interactive service, create a separate application, auto run it at startup, then do some kind of interprocess communication between the service and the regular exe:
 - sockets
 - memory mapped files
 - pipes
 - data copy
etc...

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #10 on: July 12, 2018, 02:40:00 pm »
Great, thanks, the beep was just there to confirm the service was running, so I'll take it out now..

I guess I could try and replace beep with a simple visit to PHP page, using indy socket.

The PHP page can simply update a database to show it received signal from the service. No need to send anything back.

Does that sound like something Win10 would allow, indy socket to outside URL?

GetMem

  • Hero Member
  • *****
  • Posts: 3161
Re: Windows10 Daemon start is timing out
« Reply #11 on: July 12, 2018, 02:47:06 pm »
Quote
Great, thanks, the beep was just there to confirm the service was running, so I'll take it out now..
Your service works fine, the worker thread is started. I tested by creating a file, so you can remove the beep if you like.

Quote
Does that sound like something Win10 would allow, indy socket to outside URL?
Definitely yes. Of course it depends on the firewall settings too, but you can always add an exception to windows defender or whatever firewall you use.
« Last Edit: July 12, 2018, 02:50:23 pm by GetMem »

Michael Collier

  • Full Member
  • ***
  • Posts: 233
Re: Windows10 Daemon start is timing out
« Reply #12 on: July 13, 2018, 05:37:12 am »
Yes.  That caption appears only when the command window is started with elevated rights.

I wasn't at the computer when this was entered but I was sent the info..
net user administrator /active:yes

This seemed to get service registration going, I'm not clear on the sequence that led up to this being needed, and not sure if the cmd window had been opened as admin...but thought I'd mention it in case it helps others..

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus