You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Norman Tuttle <nt...@photon.poly.edu> on 2003/10/16 23:09:27 UTC
Patch closes socket before reopening in open_socket in case of
TIME_WAIT exhaustion; issue of memory allocation checking in the APR
This patch makes the open_socket() function non-recursive, providing the
benefits of iterative functions in terms of performance, also replacing
the close_socket (same level) reference with the lower level
apr_socket_close(), since this would reserve close_socket() for a case
where the open_socket() successfully occurred. This socket closure now
also occurs in the case where a socket is to be reopened in the case of
TIME_WAIT exhaustion, which was the recursive condition. Please examine
and apply this change, which was made to the current CVS tree, without
reference to my former submission.
-Norman Tuttle, OpenDemand Systems Developer, ntuttle@opendemand.com
PS: The conditions of lack of success for apr_socket_create() (found
within apr_socket_open() function) should include a case where memory
wasn't available to allocate for the creation of the APR socket structure,
but I did not see evidence of this in either the Win32 or Unix versions of
the APR library. Both functions call a void function alloc_socket() which
does the allocation and then immediately sets members of the allocated
socket, so they are obviously assuming the allocation occurred.
Unfortunately, real software cannot be so sure. I was wondering if (1) the
APR provided alternate functions which check for this failure case, and
(2) how many APR functions are doing memory checking. I am dittoing this
comment to the APR mailing list.
Redo for: Patch closes socket before reopening in open_socket in
case of TIME_WAIT exhaustion [Ref A3]
Posted by Norman Tuttle <nt...@photon.poly.edu>.
Attached is my redo of the patch for flood_net.c explained below:
-Norman Tuttle, developer, OpenDemand Systems ntuttle@opendemand.com
On Thu, 16 Oct 2003, Norman Tuttle wrote:
> This patch makes the open_socket() function non-recursive, providing the
> benefits of iterative functions in terms of performance, also replacing
> the close_socket (same level) reference with the lower level
> apr_socket_close(), since this would reserve close_socket() for a case
> where the open_socket() successfully occurred. This socket closure now
> also occurs in the case where a socket is to be reopened in the case of
> TIME_WAIT exhaustion, which was the recursive condition. Please examine
> and apply this change, which was made to the current CVS tree, without
> reference to my former submission.