Incorrect fallthrough in memcached_behavior_set for REMOVE_FAILED_SERVERS

Bug #1284819 reported by Martin C. Martin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libmemcached
New
Undecided
Unassigned

Bug Description

memcached_behavior_set contains the following two cases, the first falls through into the second:

  case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
    ptr->flags.auto_eject_hosts= bool(data);

  case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
    if (data == 0)
    {
      return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT,
                                        memcached_literal_param("MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT requires a value greater then zero."));
    }
    ptr->server_failure_limit= uint32_t(data);
    break;

Having zero data for the first is perfectly valid (it means "don't remove failed servers,"), when when we fall through, it causes an error. There should be a "break" at the end of that first case block.

Revision history for this message
Martin C. Martin (martin-b69y0hv8h) wrote :

There's a corresponding problem in memcached_behavior_get:

case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
 return ptr->server_failure_limit;

should read:

case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
 return ptr->flags.auto_eject_hosts;

case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
 return ptr->server_failure_limit;

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.