apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Vieiro <anto...@antonioshome.net>
Subject apr_socket_close hangs on windows?
Date Fri, 29 Jul 2011 11:53:46 GMT
Hi all,

I am performing some heavy-duty load testing on a networked APR based
server on Windows.

After each request I close the client socket with the code (see below).

I've noticed random hangs on "apr_soket_close", i.e, the the "trying
apr_socket_close" message is printed out, but not the next "Client
socket closed".

My question is: is the code below correct? (i.e, apr_socket_shutdown
followed by an apr_socket_closed) Is there a know bug with
apr_socket_close?

Thanks in advance,
Antonio

P.S.: The code

void thread_close_socket(apr_socket_t *client_socket)
{
	apr_status_t status;

	LOG(LOG_DEBUG, "Trying apr_socket_shutdown on socket %p...\n", client_socket);
	status = apr_socket_shutdown(client_socket, APR_SHUTDOWN_READWRITE);
	if (status != APR_SUCCESS) {
		LOG(LOG_ERROR, "Failed to shutdown socket %p\n",
				client_socket);
	}
	LOG(LOG_DEBUG, "Trying apr_socket_close on socket %p...\n", client_socket);
	status = apr_socket_close(client_socket);
	if (status != APR_SUCCESS) {
		LOG(LOG_ERROR, "Failed to close socket %p\n",
				client_socket);
	}
	LOG(LOG_DEBUG, "Client socket closed\n");
}

Mime
View raw message