I had this problem about 2.5 years ago (but still use older version of
Synapse)

1. Check the version of OpenSSL installed; sometimes the latest has a few
twists, in my tests I am running right now (running for days with thousands
of hits) I'm using 0.9.8k on Linux but will be upgrading shortly and can let
you know the results.

2. Definitely do not use Write/Writeln in threads unless you use a critical
section.

3. I modified the ssl_openssl_lib file locking_callback function: (NOTE: Not
sure of performance or other issues this may cause, but it has worked well
for me for over 2 years now, can't test on Windows or latest versions of
synapse, so again, your mileage may vary...)

In the file ssl_openssl_lib.pas:

procedure locking_callback(mode, ltype: integer; lfile: PChar; line:
integer); cdecl;
begin
  if (mode and 1) > 0 then
  begin
    SSLCS.Enter;
  end
  else
  begin
    SSLCS.Leave;
  end;
end;


Jason



On Tue, Aug 31, 2010 at 3:45 AM, Lukas Gebauer <[email protected]> wrote:

> > I've been testing Synapse's own httpsserv-demo. It works well on
> > Windows, but on Linux it appears not to be thread-safe and crashes
> > badly.
>
> First idea - are you sure if is write/writeln call thread safe? I
> remember funny error in some old FPC when writeln was called inside
> thread. It reset socket LastError and Synapse was mangled. So, try to
> call wrie/writeln by some thread-safe way.
>
> Otherwise it's looks like some multithreaded problem inside Openssl.
> OpenSSL provides some hooks for external locks. But synapse using it!
> See InitLocks procedure inside ssl_openssl_lib.pas.
>
> Please, check:
>
> - if this procedure is called. (If not, then shared library does not
> export needed functions.)
>
> - if is called, check TCriticalSection class implementation for your
> platform.
>
>
>
> --
> Lukas Gebauer.
>
> http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.
> http://geoget.ararat.cz/ - Geocaching solution
>
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> synalist-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to