Added logging and som checks.
This commit is contained in:
@ -155,6 +155,8 @@ return_rc:
|
||||
/**
|
||||
* Remove a descriptor from the set of descriptors within the
|
||||
* polling environment.
|
||||
* The state change command may fail because concurrent threads may call
|
||||
* dcb_set_state simultaneously and the conflict is prevented in dcb_set_state.
|
||||
*
|
||||
* @param dcb The descriptor to remove
|
||||
* @return -1 on error or 0 on success
|
||||
@ -169,6 +171,10 @@ poll_remove_dcb(DCB *dcb)
|
||||
|
||||
CHK_DCB(dcb);
|
||||
|
||||
if (dcb->state != DCB_STATE_POLLING) {
|
||||
goto return_rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state to NOPOLLING and remove dcb from poll set.
|
||||
*/
|
||||
@ -195,22 +201,6 @@ poll_remove_dcb(DCB *dcb)
|
||||
rc = 0;
|
||||
goto return_rc;
|
||||
}
|
||||
/**
|
||||
* State transition failed. This may be due some more serious error
|
||||
* in how dcb is handled.
|
||||
*/
|
||||
else
|
||||
{
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [poll_remove_dcb] Unable to set state %s for dcb %p "
|
||||
"in state %s. Removing from poll set failed.",
|
||||
pthread_self(),
|
||||
STRDCBSTATE(new_state),
|
||||
STRDCBSTATE(old_state));
|
||||
ss_dassert(false);
|
||||
goto return_rc;
|
||||
}
|
||||
|
||||
/** Set bit for each maxscale thread */
|
||||
bitmask_copy(&dcb->memdata.bitmask, poll_bitmask());
|
||||
@ -315,10 +305,9 @@ poll_waitevents(void *arg)
|
||||
if (dcb_fake_write_ev[dcb->fd] != 0) {
|
||||
skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] "
|
||||
"%lu [poll_waitevents] "
|
||||
"Added fake events %d to ev %d.",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
dcb_fake_write_ev[dcb->fd],
|
||||
ev);
|
||||
ev |= dcb_fake_write_ev[dcb->fd];
|
||||
@ -333,9 +322,8 @@ poll_waitevents(void *arg)
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] event %d dcb %p",
|
||||
"%lu [poll_waitevents] event %d dcb %p",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
ev,
|
||||
dcb);
|
||||
|
||||
@ -347,10 +335,9 @@ poll_waitevents(void *arg)
|
||||
eno = dcb_fake_write_errno[dcb->fd];
|
||||
skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] "
|
||||
"%lu [poll_waitevents] "
|
||||
"Added fake errno %d. %s",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
eno,
|
||||
strerror(eno));
|
||||
}
|
||||
@ -359,10 +346,9 @@ poll_waitevents(void *arg)
|
||||
if (eno != 0) {
|
||||
skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] "
|
||||
"%lu [poll_waitevents] "
|
||||
"EPOLLERR due %d, %s.",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
eno,
|
||||
strerror(eno));
|
||||
}
|
||||
@ -404,10 +390,9 @@ poll_waitevents(void *arg)
|
||||
{
|
||||
skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] "
|
||||
"%lu [poll_waitevents] "
|
||||
"Accept in fd %d",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
dcb->fd);
|
||||
atomic_add(&pollStats.n_accept, 1);
|
||||
dcb->func.accept(dcb);
|
||||
@ -416,10 +401,9 @@ poll_waitevents(void *arg)
|
||||
{
|
||||
skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu %d [poll_waitevents] "
|
||||
"%lu [poll_waitevents] "
|
||||
"Read in dcb %p fd %d",
|
||||
pthread_self(),
|
||||
thread_id,
|
||||
dcb,
|
||||
dcb->fd);
|
||||
atomic_add(&pollStats.n_read, 1);
|
||||
|
@ -70,8 +70,8 @@ session_alloc(SERVICE *service, DCB *client)
|
||||
errno = 0;
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [session_alloc] Allocating memory for session "
|
||||
"object failed. Errno %d, %s.",
|
||||
"%lu [session_alloc] FAiled to allocate memory for session "
|
||||
"object due error %d, %s.",
|
||||
pthread_self(),
|
||||
eno,
|
||||
strerror(eno));
|
||||
@ -126,8 +126,8 @@ session_alloc(SERVICE *service, DCB *client)
|
||||
client->session = NULL;
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [session_alloc] Creating router client session "
|
||||
"failed. Freeing session.",
|
||||
"%lu [session_alloc] Failed to create router "
|
||||
"client session. Freeing allocated resources.",
|
||||
pthread_self());
|
||||
free(session);
|
||||
session = NULL;
|
||||
|
Reference in New Issue
Block a user