Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.3.19
-
None
Description
RoutingWorker* RoutingWorker::pick_worker()
|
{
|
static int id_generator = 0; |
int id = this_unit.id_min_worker |
+ (mxb::atomic::add(&id_generator, 1, mxb::atomic::RELAXED) % this_unit.nWorkers);
|
return get(id); |
}
|
In code above, id_generator is int, when it overflows, it becomes negative integer, then we will have an invalid worker_id in 2.2.
in 2.3, it's different, but `get(id)` will return nullptr, this requires the calling method to check if worker is empty. Apparently, gw_process_one_new_client is not doing it:
1487 mxs::RoutingWorker* worker = mxs::RoutingWorker::pick_worker();
|
1488
|
1489 worker->execute([=]() {
|
suggested fix:
change id_generator to unsigned type