Re: bugs in HTHost_ ???

In your message from [Fri, 13 Jun 1997 14:40:27 -0700] you wrote:
: Yes.  I'm running into some mysterious access violations in
: HTHost_forceFlush.  The  request structure in the HTNet * returned from
: host->pipeline seems to be corrupt or uninitialized. Actually, the
: pipeline itself looks suspicious since the first object is null too.
: However, this is just with a single request at a time and I'm not trying
: to kill anything.

 i remember that i saw the empty first element in the pipeline, but
 it stopped bothering me (maybe due to my patches or due to "luck").

 I will use this opportunity to explain my killing-request problem:
 
 The code in  HTHost_free (HTHost * host, int status) seems suspicious to me,
 if one simplifies the ifdes, it comes down to

PUBLIC BOOL HTHost_free (HTHost * host, int status)
{
    if (host->channel == NULL) return NO;
    if (host->persistent && !host->close_notification &&
	(!host->reqsPerConnection ||
	 (host->reqsPerConnection && host->reqsMade < host->reqsPerConnection)))
    {
	if (CORE_TRACE)
	    HTTrace("Host Object. keeping socket %d\n", HTChannel_socket(host->channel));
	HTChannel_delete(host->channel, status);
    } else {
	if (CORE_TRACE)
	    HTTrace("Host Object. closing socket %d\n", HTChannel_socket(host->channel));

	/* 
	**  By lowering the semaphore we make sure that the channel
	**  is gonna be deleted
	*/
	HTChannel_downSemaphore(host->channel);
	HTHost_clearChannel(host, status);
    }
    return YES;
}

 which comes down to:

   if the host is marked as persistent and 
      there are either 
          no pipelined requests allowed or 
          the requests made are less then the max number of pipelined requests
   then
          do an unconditional delete of the data structures
   else
          lower the semaphore and clear the channel
          
 
 The first case is for the truly persistent host.
 HTChannel_delete() frees or aborts the streams and uses the semaphore
 as a guard when to free the channel. There are many things strange for me

   - why is no HTHost_clearChannel() in the first case?
     (HTEvent_unregister(), resetting the structure, HTChannel_delete())
   
   - why are no semaphores increased when the persistent channel is reused
     and a reuqest is put into the pipeline?
     
   - how is the deletion of a single request from the pipeline handled?
     HTNet_delete() calls HTHost_free(), so either HTHost_free handles the
     pipelined case or HTNet_delete() must be made more clever.

  The trace messages in the code above do not seem resemble what's going on 
  here as well.

  Comments?

: Please post any patches you come up with for HTHost ....

 i have mailed to you my patches for HTHost.c. I have a couple of other fixes
 as well, they heal some of the symptoms, but i am not convinced that these are 
 the best solution. Once i think these are correct, i will post them here.

-gustaf
--
Wirtschaftsinformatik und Softwaretechnik        
Universitaet GH Essen, FB5
Altendorfer Strasse 97-101, Eingang B, D-45143 Essen
Tel.: +49 (0201) 81003-74, Fax:  +49 (0201) 81003-73
Gustaf.Neumann@uni-essen.de
http://nestroy.wi-inf.uni-essen.de/Neumann.html

Received on Saturday, 14 June 1997 15:23:34 UTC