daemonapp bugs
Original Reporter info from Mantis: Mahris
-
Reporter name: Maris Janis Vasilevskis
Original Reporter info from Mantis: Mahris
- Reporter name: Maris Janis Vasilevskis
Description:
Really detected at 2.7.1, but no corresponding entry. Did not check 2.6
Two bugs.
Service eats 100% CPU if IsConsole=false
TDaemon with OnExecute assigned does not respond to control messages (Stop, Pause etc.).
Steps to reproduce:
To get 100% CPU, build fcl-extra/examples/daemon.lpi. Install, start and watch CPU. Control messages in this case accepted.
To get control message problem, install lazdaemon package, create a new daemon (service) application project and assign at least OnExecute event. Attempt to enter Stop on Pause in Services manager fails, you should kill process from Task Manager.
Almost sure that cleandirs sample has the same problem. Not tried, but do not see any reason for better behavior.
Additional information:
About 100% CPU.
If IsConsole=false (in fcl-extra examples reached by {apptype gui}), we go to TCustomDaemonApplication.RunGUIloop. And infinitely repeat PeekMessage which immediately returns false. Possibly, GetMessage can solve the problem.
About control messages.
fcl-extra example inherits from TCustomDaemon, where Execute returns false. In this case, TDaemonThread.Execute issues CheckControlMessage(True) supporting control messages.
cleandirs and new project inherit from TDaemon. With OnExecute assigned, TDaemon.Execute returns true, and TDaemonThread.Execute does not check control messages.
Mantis conversion info:
- Mantis ID: 23882
- OS: 2008 SP1 64 bit
- OS Build: 7601
- Build: 23596
- Platform: windows
- Version: 2.6.2
- Fixed in version: 3.0.0
- Fixed in revision: 26696 (#6aaab457)
- Monitored by: » Mahris (Maris Janis Vasilevskis)
- Target version: 2.6.4