poll.c:poll_add_event_to_dcb did not increase the pollStats.evq_pending counter which caused it to go negative, which, inturn caused all threads to spinloop with minimal timeout.

This commit is contained in:
VilhoRaatikka
2014-12-15 22:09:23 +02:00
parent 7271586701
commit 7fed679f40
2 changed files with 30 additions and 18 deletions

View File

@ -1461,7 +1461,8 @@ SERVER *server;
if (!succp) if (!succp)
{ {
if(param){ if(param)
{
LOGIF(LM, (skygw_log_write( LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE, LOGFILE_MESSAGE,
"* Warning : invalid value type " "* Warning : invalid value type "
@ -1471,7 +1472,9 @@ SERVER *server;
((SERVICE*)obj->element)->name, ((SERVICE*)obj->element)->name,
param->name, param->name,
param->value))); param->value)));
}else{ }
else
{
LOGIF(LE, (skygw_log_write( LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR, LOGFILE_ERROR,
"Error : parameter was NULL"))); "Error : parameter was NULL")));
@ -1493,7 +1496,8 @@ SERVER *server;
config_get_value(obj->parameters, config_get_value(obj->parameters,
"enable_root_user"); "enable_root_user");
allow_localhost_match_wildcard_host = allow_localhost_match_wildcard_host =
config_get_value(obj->parameters, "localhost_match_wildcard_host"); config_get_value(obj->parameters,
"localhost_match_wildcard_host");
user = config_get_value(obj->parameters, user = config_get_value(obj->parameters,
"user"); "user");
@ -1508,7 +1512,8 @@ SERVER *server;
user, user,
auth); auth);
if (enable_root_user) if (enable_root_user)
serviceEnableRootUser(obj->element, atoi(enable_root_user)); serviceEnableRootUser(obj->element,
atoi(enable_root_user));
if (allow_localhost_match_wildcard_host) if (allow_localhost_match_wildcard_host)
serviceEnableLocalhostMatchWildcardHost( serviceEnableLocalhostMatchWildcardHost(
@ -1516,7 +1521,7 @@ SERVER *server;
atoi(allow_localhost_match_wildcard_host)); atoi(allow_localhost_match_wildcard_host));
} }
} }
} } /*< if router */
else else
{ {
obj->element = NULL; obj->element = NULL;

View File

@ -717,6 +717,7 @@ unsigned long qtime;
dcb->evq.processing_events = ev; dcb->evq.processing_events = ev;
dcb->evq.pending_events = 0; dcb->evq.pending_events = 0;
pollStats.evq_pending--; pollStats.evq_pending--;
ss_dassert(pollStats.evq_pending >= 0);
} }
spinlock_release(&pollqlock); spinlock_release(&pollqlock);
@ -1338,6 +1339,10 @@ static void poll_add_event_to_dcb(
/** Set event to DCB */ /** Set event to DCB */
if (DCB_POLL_BUSY(dcb)) if (DCB_POLL_BUSY(dcb))
{ {
if (dcb->evq.pending_events == 0)
{
pollStats.evq_pending++;
}
dcb->evq.pending_events |= ev; dcb->evq.pending_events |= ev;
} }
else else
@ -1358,6 +1363,8 @@ static void poll_add_event_to_dcb(
dcb->evq.next = dcb; dcb->evq.next = dcb;
} }
pollStats.evq_length++; pollStats.evq_length++;
pollStats.evq_pending++;
if (pollStats.evq_length > pollStats.evq_max) if (pollStats.evq_length > pollStats.evq_max)
{ {
pollStats.evq_max = pollStats.evq_length; pollStats.evq_max = pollStats.evq_length;