You are not logged in.
Pages: 1
Thanks for the great support.
At first the supplied reproduction still did not work.
Because NotifyThreadEnded was never called (setting TTest.Stop overrules the default behaviour?).
So I added it to TTest.Stop and now it works fine.
procedure TTest.Stop(Sender: TThread);
begin
TSynLog.Add.Log(sllTrace, 'End thread');
TSynLog.Add.NotifyThreadEnded;
end;
Only with x86_64-linux (Delphi 7 and x86_64-win64 are ok)
TSynLog.GetThreadContextAndDisableExceptions gives runtime error 216 and stays in critical section. This locks the application.
procedure TSynLog.GetThreadContextAndDisableExceptions;
var
id: TThreadID;
begin
id := GetCurrentThreadId;
// most of the time, the thread didn't change so this method is inlined
if id <> fThreadID then <== values are equal, perhaps fThreadID needed a reset?
// quickly switch fThreadContext/fThreadIndex to the new thread
GetThreadContextInternal(PtrUInt(id))
{$ifndef NOEXCEPTIONINTERCEPT}
else
fExceptionIgnoredBackup := fExceptionIgnoreThreadVar^; <== here fExceptionIgnoreThreadVar is not assigned to ExceptionIgnorePerThread this gives runtime error 216
// caller should always perform in its finally ... end block an eventual:
// fExceptionIgnoreThreadVar^ := fExceptionIgnoredBackup;
fExceptionIgnoreThreadVar^ := true;
// any exception within logging process will be ignored from now on
{$endif NOEXCEPTIONINTERCEPT}
end;
reproduction:
I use Postman (performance runner) to start a view threads then I wait for the threads to stop.
When I post a new request I get the error.
program TestLog;
{$MODE Delphi}
uses
{$I mormot.uses.inc}
classes,
mormot.core.base,
mormot.core.os,
mormot.core.log,
mormot.net.server,
mormot.net.http;
type
TTest = class
private
fServer: THttpServer;
function Request(Ctxt: THttpServerRequestAbstract): cardinal;
procedure Stop(Sender: TThread);
procedure Start(Sender: TThread);
end;
function TTest.Request(Ctxt: THttpServerRequestAbstract): cardinal;
begin
TSynLog.Add.Log(sllTrace, 'Start request');
Result := HTTP_SUCCESS;
TSynLog.Add.Log(sllTrace, 'End request');
end;
procedure TTest.Stop(Sender: TThread);
begin
TSynLog.Add.Log(sllTrace, 'End thread');
end;
procedure TTest.Start(Sender: TThread);
begin
TSynLog.Add.Log(sllTrace, 'Start thread');
end;
begin
with TSynLog.Family do
begin
Level := LOG_VERBOSE;
EchoToConsole := LOG_VERBOSE;
//PerThreadLog := ptIdentifiedInOneFile;
//AutoFlushTimeOut := 10;
end;
with TTest.Create do
try
fServer := THttpServer.Create('8088', start, stop, '', 0);
fServer.WaitStarted();
fServer.OnRequest := Request;
writeln('Server is now running');
ConsoleWaitForEnterKey;
finally
Free;
end;
end.
Hello, I'm trying to build the latest version using delphi 7 crossKylix and get some errors:
The first error is intoduced on the 14th of august concerning: ConsoleReadBody
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCommons.pas(23376)
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCommonsC:/Dev/AUTOMA~1/mORMot/SynCommons.pas(56169) Hint: Variable 'c' is declared but never used in 'ConsoleWaitForEnterKey'
[Hint] SynCommons.pas(56169): Variable 'c' is declared but never used in 'ConsoleWaitForEnterKey'
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCommons.pas(56204) Error: Undeclared identifier: 'fpioctl'
[Error] SynCommons.pas(56204): Undeclared identifier: 'fpioctl'
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCommons.pas(56204) Error: Undeclared identifier: 'FIONREAD'
[Error] SynCommons.pas(56204): Undeclared identifier: 'FIONREAD'
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCommons.pas(56204) Warning: Comparing signed and unsigned types - widened both operands
[Warning] SynCommons.pas(56204): Comparing signed and unsigned types - widened both operands
[CrossKylix] DEBUG: /C/Dev/Automation/WecapServerDelphi/WecapServer.dpr(10) Fatal: Could not compile used unit 'SynCommons.pas'
[Fatal] WecapServer.dpr(10): Could not compile used unit 'SynCommons.pas'
This error is introduced on september the fourth concerning: SynCurl
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynBidirSock.pas(87)
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORC:/Dev/AUTOMA~1/mORMot/SynCurl.pas(558) Error: Incompatible types: 'TFileName' and 'PChar'
[Error] SynCurl.pas(558): Incompatible types: 'TFileName' and 'PChar'
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynCrtSock.pas(244) Fatal: Could not compile used unit 'SynCurl.pas'
[Fatal] SynCrtSock.pas(244): Could not compile used unit 'SynCurl.pas'
[CrossKylix] DEBUG: Mot/SynBidirSock.pas(88)
[CrossKylix] DEBUG: C:/Dev/AUTOMA~1/mORMot/SynBidirSock.pas(89)
Could you please help me?
Great, the linux build is working again and hasn't broken yet.
Removed the WriteLn in the 'onRequest' function (was no need for that).
Concerning the 'WSAETIMEDOUT' error reproduction, maybe I must add that there is no reverseproxy running inbetween.
When I run e.g. Fiddler the error does not occur.
Thanks for the quick reply,
I've just updated from 1.18.4363 to 1.18.4402.
Saw some interesting changes, which might help the Linux application stability.
However also: [CrossKylix] DEBUG: C:/Dev/struct/mORMot/SynCrtSock.pas(11002) Error: Constant expression violates subrange bounds.
The corresponding code: curl.Module := -1; // don't try to load any more
Code is introduced in 1.18.4397.
The 'WSAETIMEDOUT' error on Windows 10 is still there.
Hello, I'm struggling for a while now with an exception:
ECrtSocket ("SockRecvLn 10060 WSAETIMEDOUT [A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond]")
This error only occurs when the server is called from a Chrome browser (Edge is ok).
When I use the THttpApiServer class the error does not occur either.
There is no difference on running the server on windows 10 or linux (using delphi 7 or crossKylix)
The problem is narrowed down to the following code:
program Test;
uses
{$I SynDprUses.inc}
SynCommons, SynCrtSock, SynLog;
{$APPTYPE CONSOLE}
type
TTestServer = class
private
fServer: THttpServerGeneric;
public
constructor Create;
destructor Destroy; override;
function onRequest(Ctxt: THttpServerRequest): cardinal;
end;
constructor TTestServer.Create;
begin
fServer := THttpServer.Create('8888', nil, nil, '');
// fServer := THttpApiServer.Create(false);
// THttpApiServer(fServer).AddUrl('','8888', False, 'localhost');
fServer.OnRequest := onRequest;
with TSynLog.Family do
begin
Level := LOG_VERBOSE;
EchoToConsole := LOG_VERBOSE;
PerThreadLog := ptIdentifiedInOnFile;
end;
end;
destructor TTestServer.Destroy;
begin
fServer.Free;
inherited;
end;
function TTestServer.onRequest(Ctxt: THttpServerRequest): cardinal;
begin
Writeln('Hello!');
Ctxt.OutContentType := HTML_CONTENT_TYPE;
Ctxt.OutContent := 'Hello!';
Result := 200;
end;
var
LServer: TTestServer;
begin
LServer := TTestServer.Create;
Writeln('Server localhost:8888');
Readln;
LServer.Free;
end.
In this sample the server keeps running.
But in the server application I've created which uses TWebSocketServer and runs in a Docker container on Linux, the application stops working after a while with several exceptions.
Further our Angular client application takes a few seconds to start (after the WSAETIMEDOUT error is reported).
I hope this explains the problem sufficiently.
Help would be much appreciated.
Pages: 1