Skip to content

Commit

Permalink
Fix dynamic buffer bug occuring in rare condition (sonic-net#1678)
Browse files Browse the repository at this point in the history
What I did
Bug:
The buffermgrd can keep adding suffix to the buffer pool reference if the buffer pool isn't found when it is being referenced. In most of the cases, it's caused by wrong configuration.
Cause:
In handleBufferProfileTable, the value of each field is designated by a (lvalue) reference to the object in the tuple, which means the object in the tuple will be changed if the value is changed in the function.
Fix:
Pass the value of each field by value instead of reference.

- Why I did it
Fix bug.

- How I verified it
Manually test.

Signed-off-by: Stephen Sun stephens@nvidia.com
  • Loading branch information
stephenxs authored Apr 1, 2021
1 parent 691bd30 commit ae5f051
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cfgmgr/buffermgrdyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,8 @@ task_process_status BufferMgrDynamic::handleBufferProfileTable(KeyOpFieldsValues
}
for (auto i = kfvFieldsValues(tuple).begin(); i != kfvFieldsValues(tuple).end(); i++)
{
string &field = fvField(*i);
string &value = fvValue(*i);
const string &field = fvField(*i);
string value = fvValue(*i);

SWSS_LOG_DEBUG("field:%s, value:%s", field.c_str(), value.c_str());
if (field == buffer_pool_field_name)
Expand Down

0 comments on commit ae5f051

Please sign in to comment.