Alexander Bauer escreveu:
> Hi,
>
> i tried to answer to the mailing list, but the message always came back
> to me ?!
> So i will give you the answer direct. If it solves your problem, you
> can repost the answer to the list.
>
> I currently porting my Kylix code to FPC and had the same problem!
> I think the problem is in FPC and not in Synapse.
>
> The problem occurs only if you don't create the new threads suspended.
> Also do not a resume a thread in his constructor.
>
> The following code should work very nice ...
>
> //----------------------------------------------------------------------------
>
>
> Constructor TTCPHttpThrd.Create(Hsock:TSocket);
> begin
> inherited create(true); // <-- Create supended !!!
> sock:=TTCPBlockSocket.create;
> Headers := TStringList.Create;
> InputData := TMemoryStream.Create;
> OutputData := TMemoryStream.Create;
> Sock.socket:=HSock;
> FreeOnTerminate:=true;
> Priority:=tpNormal;
> end;
>
> //----------------------------------------------------------------------------
>
>
> procedure TTCPHttpDaemon.Execute;
> var
> ClientSock:TSocket;
> HttpThrd: TTCPHttpThrd;
> begin
> with sock do
> begin
> CreateSocket;
> setLinger(true,10);
> bind('0.0.0.0','80');
> listen;
> repeat
> if terminated then break;
> if canread(1000) then
> begin
> ClientSock:=accept;
> if lastError=0 then
> begin
> HttpThrd := TTCPHttpThrd.create(ClientSock);
> HttpThrd.Resume; // <-- Resume the thread here
> end;
> end;
> until false;
> end;
> end;
>
>
>
>
>
>
> Jorge Aldo schrieb:
>> i found an annoying bug with Synapse + FreePascal 2.2.0
>>
>> using openload to stress test the default http server example, i
>> found that it locks after openload count reaches 3800+ connections...
>>
>> this is impairing two of my projects : lightwebserver and
>> lightwebproxy...
>>
>> anyone knows how to circunvent this bug ?
>>
>> -------------------------------------------------------------------------
>>
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> synalist-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/synalist-public
>>
>>
>
>
>
>
>
Applied your patch but no improvements.
OpenLoad output :
C:\programacao\proxy>openload 192.168.1.20:80
URL: http://192.168.1.20:80/
Clients: 5
MaTps 312.00, Tps 312.00, Resp Time 0.016, Err 0%, Count 312
MaTps 312.64, Tps 318.36, Resp Time 0.016, Err 0%, Count 631
MaTps 311.58, Tps 302.09, Resp Time 0.017, Err 0%, Count 934
MaTps 308.10, Tps 276.72, Resp Time 0.018, Err 0%, Count 1211
MaTps 305.29, Tps 280.00, Resp Time 0.018, Err 0%, Count 1491
MaTps 302.47, Tps 277.17, Resp Time 0.018, Err 0%, Count 1769
MaTps 302.67, Tps 304.39, Resp Time 0.016, Err 0%, Count 2074
MaTps 304.24, Tps 318.41, Resp Time 0.016, Err 0%, Count 2394
MaTps 304.04, Tps 302.19, Resp Time 0.017, Err 0%, Count 2698
MaTps 303.93, Tps 303.00, Resp Time 0.016, Err 0%, Count 3001
MaTps 302.93, Tps 293.94, Resp Time 0.017, Err 0%, Count 3297
MaTps 300.91, Tps 282.74, Resp Time 0.018, Err 0%, Count 3582
MaTps 301.32, Tps 305.00, Resp Time 0.016, Err 0%, Count 3887
<stops responding here>
The program exits (when i type exit at its command prompt) with the
following errors :
C:\PROGRA~1\proxy>testserv
exit
An unhandled exception occurred at $0073006F :
EAccessViolation : Access violation
$0073006F
$00405C72
An unhandled exception occurred at $00405C6F :
EAccessViolation : Access violation
$00405C6F
$00405C72
The server source-code is this :
http.pas:
http://pastebin.com/m5e08ebe0
testserv.pp:
Uses Http;
Var
temp : TTCPHttpDaemon;
cmd : string;
Begin
Temp := TTCPHttpDaemon.Create;
Temp.Resume;
Repeat
ReadLn(Cmd);
Until Cmd = 'exit';
Temp.Free;
End.
compiled with :
Free Pascal Compiler version 2.2.0 [2007/09/09] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
synapse:
Release 38
2007-12-21
Last message incorrectly gone to one user email address instead of the
list (dunno what i did wrong, just pressed "responder" on thunderbird)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public