EntityBulker SIGSEGV when create_entry attr_count 0 #2224
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Removed access to variable causing the segfault while create_entry with attr_count 0
Why I did it
When the bulker create_entry was called with attr_count as 0, the swss log would access the attr_list and try to print the id. This was causing the orchagent crash:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000056230970734d in EntityBulker<_sai_nat_api_t>::create_entry (this=0x56230b31f988, object_status=0x56230b3e4a20, entry=, attr_count=0, attr_list=0x7ffcadbbbef0) at /usr/include/c++/8/bits/unordered_map.h:309
How I verified it
Verified orchagent does not segfault under this condition.
Details if related