W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

Re: Incorrect order in HTLibTerminate of HTLib.c?

From: Michel Philip <philipm@altern.org>
Date: Thu, 31 Jan 2002 23:15:57 +0100
Message-ID: <3C59C21D.1A7ADC82@altern.org>
To: Jeff Adams <jeffa@coursewave.com>
Cc: www-lib@w3.org

Hi Jeff,


I have tried to check if reversing the calls was obvious.
But I see that:
 1) HTHost_deleteAll() calls free_object which call HTChannel_delete
 2) HTChannel_deleteAll() does not directly calls HTHost_xxx function
 
Then I rather advice to let the calls in that order.

To maillist reader think about what can make the crash 
I suggest you provide
- global description of own program use the lib w3
  or which sample you've based it on
- how do you make the HTLibTerminate been called
- the stack call beetween HTChannel_deleteAll() and HTHost_getReadNet()
  for it is not obviuos reading the code

/m


Jeff Adams wrote:
> 
> Hello,
> 
> In HTLibTerminate(void) of HTLib.c a number of cleanup/delete functions
> are called, in particular,
> 
> HTHost_deleteAll();
>    followed by
> HTChannel_deleteAll();
> 
> but I am wondering whether in fact
> HTChannel_deleteAll() should be called BEFORE HTHost_deleteAll()
> 
> the reason I ask this is that I just debugged a situation
> in my app in which if the user requests a URL to a server
> that either isn't up or gets shutdown while in use
> a normal and proper "Failed to connect" error occurs.
> 
> However, on shutdown of the app and within
> the call to HTLibTerminate(void), I can get an unmapped memory
> exception which is traced to the delete code in HTChannel_deleteAll()
> requesting the use of the host associated with an apparently
> still alive read channel which ends up
> calling HTHost_getReadNet(HTHost * host) in HTHost.c
> 
> Seeing that the code currently does a HTHost_deleteAll before calling
> HTChannel_deleteAll I reversed the calling of these two functions
> and it eliminated the unmapped exception.
> 
> When HTHost_deleteAll() was added to HTLibTerminate do you think
> someone just did not think that there are instances when
> open channels might still need the host info around on their delete.
> This seems to be the case I have found...
> 
> Anyone else ever see this or know of any problems with
> reversing these two calls?
> 
> Thanks
> Jeff
> 
> --
Received on Thursday, 31 January 2002 17:16:36 GMT

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