n 10/13/07, Nigel Liang <ncliang at gmail.com> wrote:
Hi,
Http requests open sockets and forget to close them. Left running over a long period, the socket file descriptor starts getting large. Once it exceeds FD_SETSIZE, the behavior becomes unpredictable and results in funcky crashes.
-Nigel
dlls/wininet/internet.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 0edca74..8e3a98e 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1014,6 +1014,9 @@ BOOL WINAPI InternetCloseHandle(HINTERNE return FALSE; }
- if (lpwh->htype == WH_HHTTPREQ)
NETCON_close(&((LPWININETHTTPREQW)lpwh)->netConnection);
- WININET_Release( lpwh ); WININET_FreeHandle( hInternet );
-- 1.4.1
Hi,
This patch was sent 4 days ago and it hasn't gone in yet. Could anyone give me some comments on it? Dan filed bug 10032 which is related to this. While we shouldn't be using select() on high FDs for networking, this patch closes the sockets that were open by http requests to avoid getting to high FDs...
Thanks, -Nigel
Hi, well looking over this very quickly right off the bat it does not seem correct to me. WININET_Release will call the close_connection method of the handle if it is defined, and for WH_HHTTPREQ this is HTTP_CloseConnection, which does call NETCON_Close along with sending all the proper status notifications, etc.
So if in fact NETCON_Close is _not_ being called for some reason, you need to track down where involving those functions either why the proper one is not getting called (if that is the case) or if that function somehow needs to call NETCON_Close when it doesn't.
Misha