W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

Re: Solution for possible crash if using SSL

From: <jose.kahan@w3.org>
Date: Wed, 26 Jul 2000 17:21:02 +0200 (MET DST)
Message-Id: <200007261521.RAA09553@tuvalu.inrialpes.fr>
To: "Kallweit, Heiner" <Heiner.Kallweit@commerzbank.com>
CC: "'www-lib@w3.org'" <www-lib@w3.org>
Hello Heiner,

I saw your patch. One thing that worries me is that your patch blocks
all flushes that may be done in any host. Did you try to use the
host->forceWriteFlush variable instead, to do the same thing?

That is

if (host->force_writeFlush || targetNet == NULL)

instead of

if (in_flush || targetNet == NULL)

It looks like a better solution to me. Could you give it a try and then
report back to the list?

Thanks!

-Jose

In our previous episode, Kallweit, Heiner said:
> 
> I ran into serious trouble when using a CGI-programm that (not only)
> forwards
> requests via Libwww and SSL. Every 100th request I got a core dump.
> Eventually I found out that there is a recursive function call. To cut a
> long
> story short: HTHost_forceFlush -> HTTPEvent_Flush ->
> HTBufferWriter_lazyFlush
> -> HTSSLWriter_write -> HTSSLReader_read -> HTHost_forceFlush
> If your machine is fast enough (mine was) this can cause a stack overflow.
> I stopped the recursion by changing HTHost_forceFlush to the following:
> 
> PUBLIC int HTHost_forceFlush(HTHost * host)
> {
>     static BOOL in_flush=NO;
>     HTNet * targetNet = (HTNet *) HTList_lastObject(host->pipeline);
>     int ret;
>     if (in_flush || targetNet == NULL) return HT_ERROR;
>     HTTRACE(CORE_TRACE, "Host Event.. FLUSH passed to `%s\'\n" _
>  
> HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet))));
>     host->forceWriteFlush = in_flush = YES;
>     while ((ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel),
> targetNet->event.param, Event_FLUSH))==HT_WOULD_BLOCK);
>     host->forceWriteFlush = in_flush = NO;
>     return ret;
> }
Received on Wednesday, 26 July 2000 11:21:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:37 GMT