Well, the demo pretty much does the same thing. It listens on incoming connections and creates a new thread for handling the TCP/IP-connection. The threads don't even try to pass data between each other after that. The method is rock solid with http.
I did some further tests. The same problem exists on Ubuntu jaunty. I also made a Kylix-version, which also crashes with runtime error 231, once you start hammering it with traffic. So, there seems to be something badly wrong with synapse's openssl-support on Linux OR the demo does things wrong. New version at: http://www.starsoft.fi/jarto/httpsserv.tgz If you test this, notice that the server listens on port 4430. An easy way to test is to create a long file with a few thousand lines of: wget -q -O /dev/null --no-check-certificate https://_ip_number_:4430/ And call that from a few computers. Regards, Jarto Tarpio On Mon, Aug 30, 2010 at 10:00:13AM -0400, Jason P Sage wrote: > Not even looking at your code (time limited) I know the demo's do a > good job of showing you how to get started. I wrote a pretty meaty web > server/application server to the tune of 120,000 lines of code > thereabouts that works great on both Linux and Windows. > > I had to make my own "listener thread" and hand off "work" to worker > threads that are given the TCPIP connection and then the listener is > "reset" , then the worker is told to resume. > > This works pretty decent but the problem between windows and linux for > me was that they simply do not do multi-threading exactly the same and I > had to make some Linux and Windows specific Code to handle the multiple > threads (as you say - many hits coming from various computers) to work > smoothly. > > Initially I wrote a way the parent thread can send a message to child > threads and vice versa if necessary. I made critical sections for this > special messaging thing.. and frankly it purrs on Linux but in windows I > was being intermittently locking up for whatever reason. I did some > reasearch and multi-thread debugging is difficult - so after awhile I > never nailed the windows problem but it seemed to be getting hung as in > thread contention or or dead-lock kind of deal... whatever you call it - > I needed a better way to manage which worker threads got assigned to new > web requests in windows. I had to made a loop that "PEEKED" into the > status of the threads to see if they were done, sitting idle - and if so > I'd use the first one I found matching this criteria for the next > incoming request (from listener). > > In Linux my inter-thread Messaging system works brilliant... in windows > I needed an alternative. > > Though I'm happy to report that 90% of my code thereabouts is OS > independent... maybe a little more. > > Generally speaking the only code that needs special handling based on > the operating system for me so far is: > > * inter-thread communication ( have on Linux, not used so much on windows ) > * file things... like which way the slash goes forward for linux, and > backwards for windows... > > Honestly, not a whole heck of a lot - FreePascal is sweet on that note > for sure! So in the Synapse Library! > --Jason > > > > On 8/30/2010 9:40 AM, Jarto Tarpio 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. > > > > I changed the demo slightly to make it console-based (msgbox -> > > writeln), so it would not require X11. When I fire lots of wget- > > requests from several computers simultaneously at it, it crashes very > > fast with the error message below. > > > > I'm using Debian 5.0.5 on a Dell PowerEdge T100. > > Compiler: FPC 2.4.1 (latest 2.4.0 from the fixes-branch) > > The error can be reproduced with both the stable- and trunk-versions > > of Synapse. > > > > My changes and an unstripped binary are available at: > > http://www.starsoft.fi/jarto/httpsserv.tgz > > > > Regards, > > > > Jarto Tarpio > > > > Error message: > > *** glibc detected *** ./httpsservconsole: double free or corruption > > (!prev): 0xb6402830 *** > > ======= Backtrace: ========= > > /lib/i686/cmov/libc.so.6[0xb7633764] > > /lib/i686/cmov/libc.so.6(cfree+0x96)[0xb7635966] > > /usr/lib/i686/cmov/libcrypto.so.0.9.8(CRYPTO_free+0x3a)[0xb7430cca] > > /usr/lib/i686/cmov/libcrypto.so.0.9.8(ERR_clear_error+0x5c0)[0xb74a26f > > 0] > > /usr/lib/libssl.so(SSL_CTX_use_certificate_chain_file+0x242)[0xb757651 > > 2] > > ... > > > > > > > > ------------------------------------------------------------------------------ > > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > > Be part of this innovative community and reach millions of netbook users > > worldwide. Take advantage of special opportunities to increase revenue and > > speed time-to-market. Join now, and jumpstart your future. > > http://p.sf.net/sfu/intel-atom-d2d > > _______________________________________________ > > synalist-public mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/synalist-public > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > 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
