You are not logged in.
Pages: 1
Hi All,
This is my first post. Thanks for the great Job!
I've found an issue when using TSynDaemon in the latest mORMot2 release.
... looking at, Project Project05HttpDaemon in ...\ex\ThirdPartyDemos\martin-doyle\05-HttpDaemonORM\src as an example ...
I believe there is a bug in mORMot2 when building for 64bit and starting the project as a service.
.\Project05HttpDaemon.exe /install - OK
When starting the service, using windows services dialog, I'm getting an error:
-----------------------------
Windows could not start the Project05HttpDaemon service on
Local Computer.
Error 1067: The process terminated unexpectedly.
-----------------------------
Log File :
...
20220308 10482210 ! info SetThreadName 243c=Main
20220308 10482210 ! info Daemon started, listening on port 11111
20220308 10482210 " EXCOS EAccessViolation (c0000005) [] at 41265f
Using :
Delphi 10.4 Update 2
Win 10 pro
(It is working fine when using 16 Dec 2021 release and/or 32bit in current release)
Any thoughts?
Last edited by augusto (2022-03-09 09:27:04)
Offline
Thanks,
27158 in System.pas
while P[Result] <> #0 do
log file:
20220308 15395239 " EXCOS EAccessViolation (c0000005) [] at 41265f System.pas @PWCharLen (27158)
Offline
The problem seems to be the ServiceProc procedure in mormot.core.os.windows.inc:
procedure ServiceProc(ArgCount: cardinal; Args: PPChar); stdcall;
var
i: PtrInt;
begin
if not Assigned(ServiceSingle) then
exit;
SetLength(ServiceSingle.fArgsList, ArgCount - 1);
for i := 0 to ArgCount - 2 do //<- problem here
begin
Inc(Args);
ServiceSingle.fArgsList[i] := Args^;
end;
Because i is a 64-bit int and ArgCount is a cardinal, if ArgCount is less than 2 then the for loop termination value wraps around to a very high number and causes it to try to process arguments that don't exist.
Offline
You are right.
Should be fixed by https://github.com/synopse/mORMot2/commit/8043c5de
and https://github.com/synopse/mORMot2/commit/8c5b973e
Sorry for the issue.
Online
That's great!
Thanks
Offline
Hi ab,
i get the same issue with 64bits (Windows), the service install but it stuck at starting... status not running..., but it works at 32bits(windows)
even with latest master branch source.
Thanks
mormot 2.0.4222
Windows 10 64Bit
Delphi 11.2
Last edited by zakaria (2022-10-21 10:47:48)
Offline
Do you have any exception raised in this case?
Does https://github.com/synopse/mORMot2/commit/e7aae08b help ?
Online
i updated the sources to https://github.com/synopse/mORMot2/commit/e7aae08b
but it still stuck at starting.. status, not getting running... status.
Offline
I tried it the weekend and I noticed that it creates an exception when trying to create the service
mormot.core.windows.inc
function TServiceController.Start(const Args: array of PChar): boolean;
begin
if length(Args) = 0 then
result := StartService(fHandle, 0, nil)
else
result := StartService(fHandle, length(Args), @Args[0]);
end;
tried admin account, same problem
Last edited by dcoun (2022-10-24 17:05:20)
Offline
Please try with https://github.com/synopse/mORMot2/commit/b6bca670
On my side, I don't have any problem on Win64.
If the problem persists on your side, please try to replace the main block of Project05HttpDaemon as
begin
LogFamily := SQLite3Log.Family;
LogFamily.Level := LOG_VERBOSE;
LogFamily.PerThreadLog := ptIdentifiedInOnFile;
LogFamily.EchoToConsole := LOG_VERBOSE;
LogFamily.CustomFileName := IntToHex(GetTickCount64, 8);
WindowsServiceLog := SQLite3Log.DoLog;
SQLite3Log.Add.Log(sllInfo, 'Daemon exe run %', [paramstr(1)]);
SampleDaemon := TSampleDaemon.Create(
TSampleDaemonSettings, Executable.ProgramFilePath, '', '');
try
LogFamily.Level := LOG_VERBOSE;
LogFamily.EchoToConsole := LOG_VERBOSE;
SampleDaemon.CommandLine;
finally
SQLite3Log.Add.Log(sllInfo, 'Daemon exe leave');
end;
It should create several log files, with verbose information.
Online
Offline
@dcoun
This is weird because I am not able to reproduce the problem here.
I will look into your logs in detail.
Edit: Please try with https://github.com/synopse/mORMot2/commit/6d71a0a4
Edit 2: I tried with Alexandria 11.1 on Win64 and I have no problem with Project05HttpDaemon.dpr source code.
Two questions:
1) I think the log of /start is missing in the gist. Can you add it?
2) Did you make any other change to Project05HttpDaemon source ?
Online
Clean from github, last commit + the code you requested above
Alexandria 11.2 patch1
Only added win64 target
https://gist.github.com/dkounal/63adc5a … 01c26c29a9
Last edited by dcoun (2022-10-26 08:00:10)
Offline
Offline
I was able to reproduce the problem on some Windows 11 specific configuration, whereas in older Windows version, there was no issue.
There was a problem with a handle defined as 32-bit instead of THandle (=64-bit on Win64).
It should be fixed now with https://github.com/synopse/mORMot2/commit/66bbc6db
Sorry for the delay in fixing this.
Online
Thank you @ab, it works now
Offline
The problem was already existing on mORMot 1.
See https://synopse.info/fossil/info/7c53aeed8d
It is weird that it has not been reported before.
Online
Hi ab, i tried the last commit and it Works as expected, Thanks
Offline
Hi ab,
i have some issues when i installed a windows service, it give me this error when i try to start it
Error 1053 [ERROR_SERVICE_REQUEST_TIMEOUT] occured with [/start] (Start) on Service 'MySampleService'
mormot 2.4418,D11.2, windows 64 bits
Thanks
Offline
regressionly, the log file containt just one line<
09/12/2022 07:55:40.288 Last error 1 mormot.core.os.TServiceController(028242b04f30) Start(MySampleService) failed "ERROR_SERVICE_REQUEST_TIMEOUT" (1053)
Offline
Pages: 1