Skip to content

Commit ae5f051

Browse files
authored
Fix dynamic buffer bug occuring in rare condition (sonic-net#1678)
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 [email protected]
1 parent 691bd30 commit ae5f051

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cfgmgr/buffermgrdyn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,8 @@ task_process_status BufferMgrDynamic::handleBufferProfileTable(KeyOpFieldsValues
16091609
}
16101610
for (auto i = kfvFieldsValues(tuple).begin(); i != kfvFieldsValues(tuple).end(); i++)
16111611
{
1612-
string &field = fvField(*i);
1613-
string &value = fvValue(*i);
1612+
const string &field = fvField(*i);
1613+
string value = fvValue(*i);
16141614

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

0 commit comments

Comments
 (0)