About the OpenSSL versions. Debian and Ubuntu have 0.9.8g. Suse has 0.9.8h.
The locking method, you mention below results in a you using only one huge lock for all the openssl-methods. I tried the same and it didn't help. I wonder if the old synapse works better or if your site has just never been hit really hard? I experimented a bit with an extra "BigLock" TCriticalSection: If I add the BigLock around any socket operation (create, init of ssl, read, write, destroy), the server is a lot more stable. I can easily get hundeds of thousands of page views. However, this slows down everything pretty badly. I'll let a test like that run over the night. If I add the BigLock only around create, init of ssl and destroy (not around read and write), I get mixed results. On Debian it survived for almost an hour but on Suse it crashed in less than a minute. Note: I'm doing some really cruel testing here: Tens of millions of page views with nonstop traffic from several computers. The Windows version can take that kind of beating easily for days and weeks. The Linux version with http can also. The only thing making this unstable on Linux is https. Regards, Jarto Jason wrote: > 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
