When there is no load but there are zombies to be cleaned up, it used to take at least nthreads*timeout time to get socket closed. Now in this case, once the timeout exceeds for the first time, all threads are allowed to call dcb_process_zombies without having to wait the timeout period until there are no zombies anymore.

This commit is contained in:
vraatikka
2013-09-25 09:12:18 +03:00
parent 20c4a60f01
commit 3b647e47ab
4 changed files with 62 additions and 23 deletions

View File

@ -63,15 +63,16 @@ session_alloc(SERVICE *service, DCB *client)
SESSION *session;
session = (SESSION *)calloc(1, sizeof(SESSION));
ss_info_dassert(session != NULL, "Allocating memory for session failed.");
ss_info_dassert(session != NULL,
"Allocating memory for session failed.");
if (session == NULL) {
int eno = errno;
errno = 0;
skygw_log_write_flush(
LOGFILE_ERROR,
"%lu [session_alloc] FAiled to allocate memory for session "
"object due error %d, %s.",
"%lu [session_alloc] Failed to allocate memory for "
"session object due error %d, %s.",
pthread_self(),
eno,
strerror(eno));
@ -94,14 +95,18 @@ session_alloc(SERVICE *service, DCB *client)
session->state = SESSION_STATE_ALLOC;
/**
* Associate the session to the client DCB and set the reference count on
* the session to indicate that there is a single reference to the session.
* There is no need to protect this or use atomic add as the session has not
* been made available to the other threads at this point.
* the session to indicate that there is a single reference to the
* session. There is no need to protect this or use atomic add as the
* session has not been made available to the other threads at this
* point.
*/
session->data = client->data;
client->session = session;
session->refcount = 1;
/** This indicates that session is ready to be shared with backend DCBs. */
/**
* This indicates that session is ready to be shared with backend
* DCBs.
*/
session->state = SESSION_STATE_READY;
/** Release session lock */