Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt SAI v1.0 headers #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

svc-acs
Copy link

@svc-acs svc-acs commented Apr 11, 2017

No description provided.

@@ -86,3 +87,4 @@ sai_switch_notification_t switch_notifications
on_switch_shutdown_request,
NULL
};
*/
Copy link
Owner

@lguohan lguohan Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch notification is now passed using SWITCH ATTRIBUTES.

such as

SAI_SWITCH_ATTR_FDB_EVENT_NOTIFY

#Resolved

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the action items here? Do you mean cleaning the commented code?


In reply to: 110933718 [](ancestors = 110933718)

Copy link
Owner

@lguohan lguohan Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in create switch, need to set attributes

SAI_SWITCH_ATTR_PORT_STATE_CHANGE_NOTIFY
SAI_SWITCH_ATTR_SHUTDOWN_REQUEST_NOTIFY #Resolved

attr.id = SAI_PORT_ATTR_FDB_LEARNING;
attr.value.s32 = SAI_PORT_LEARN_MODE_HW;
// TODO: find ??
// attr.id = SAI_PORT_ATTR_FDB_LEARNING;
Copy link
Owner

@lguohan lguohan Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAI_PORT_ATTR_FDB_LEARNING [](start = 21, length = 26)

should be SAI_BRIDGE_PORT_FDB_LEARNING_MODE_HW,

but this is only available for BRIDGE PORT, meaning only valid for ports that joins dot1q bridge.

router ports are not bridge port and do not need such option. #Resolved

@lguohan
Copy link
Owner

lguohan commented Apr 11, 2017

}

instead of removing them from vlan, we should remove them from the default dot1q bridge.

SAI_SWITCH_ATTR_DEFAULT_1Q_BRIDGE_ID

Then, later, if the port is a router port, then we create a router port for that. Otherwise, we then join the port into the default 1q bridge and assign proper vlan to it.
#Resolved


Refers to: orchagent/portsorch.cpp:150 in 3ef44b5. [](commit_id = 3ef44b5, deletion_comment = False)

vector<sai_attribute_t> &trap_id_attribs)
{
for (auto trap_id : trap_id_list)
{
for (auto attr : trap_id_attribs)
{
sai_status_t status = sai_hostif_api->set_trap_attribute(trap_id, &attr);
sai_status_t status = sai_hostif_api->set_hostif_trap_attribute(trap_id, &attr);
Copy link
Owner

@lguohan lguohan Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to use create_hostif_trap first to get a trap id #Resolved

@lguohan
Copy link
Owner

lguohan commented Apr 11, 2017

initDefaultTrapGroup();

we need to initDefaultHostTable() to create WILDCARD host table.

sai_object_id_t host_table_entry[4];
sai_attribute_t sai_if_channel_attr[2];

sai_if_channel_attr[0].id=SAI_HOSTIF_TABLE_ENTRY_ATTR_TYPE;
sai_if_channel_attr[0].value= SAI_HOST_INTERFACE_TABLE_ENTRY_TYPE_WILDCARD;

sai_if_channel_attr[1].id= SAI_HOSTIF_TABLE_ENTRY_ATTR_CHANNEL;
sai_if_channel_attr[1].value=SAI_HOST_INTERFACE_TABLE_ENTRY_CHANNEL_TYPE_PHYSICAL_NETDEV;

sai_create_hostif_table_entry_fn(&host_table_entry[0], 2, sai_if_channel_attr);

#Resolved


Refers to: orchagent/copporch.cpp:90 in 3ef44b5. [](commit_id = 3ef44b5, deletion_comment = False)

attr.id = SAI_ACL_TABLE_ATTR_BIND_POINT;
attr.value.s32 = SAI_ACL_BIND_POINT_SWITCH;
attr.id = SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST;
attr.value.s32 = SAI_ACL_BIND_POINT_TYPE_SWITCH;
Copy link
Owner

@lguohan lguohan Apr 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mellanox v1.0 sai does not support bind_point_type_switch #Closed

attr.id = SAI_ACL_TABLE_ATTR_BIND_POINT;
attr.value.s32 = SAI_ACL_BIND_POINT_SWITCH;
attr.id = SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST;
attr.value.s32 = SAI_ACL_BIND_POINT_TYPE_SWITCH;
Copy link

@itaibaz itaibaz Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch bind point not supported in mellanox implementation, as we believe it's not well defined
please use alternative bind point, such as binding to all ports #Resolved

Copy link
Collaborator

@qiluo-msft qiluo-msft Apr 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we consider LAG here? also @lguohan


In reply to: 111073589 [](ancestors = 111073589)

sai_attribute_t switch_attr;
switch_attr.id = SAI_SWITCH_ATTR_FDB_EVENT_NOTIFY;
switch_attr.value.ptr = (void *)on_fdb_event;
status = sai_switch_api->create_switch(&gSwitchId, 1, &switch_attr);
Copy link

@itaibaz itaibaz Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mandatory attribute SAI_SWITCH_ATTR_INIT_SWITCH=true is missing here #Resolved

@@ -1228,7 +1229,7 @@ sai_status_t AclOrch::createBindAclTable(AclTable &aclTable, sai_object_id_t &ta
table_attrs.push_back(attr);
}

attr.id = SAI_ACL_TABLE_ATTR_FIELD_RANGE;
attr.id = SAI_ACL_TABLE_ATTR_FIELD_ACL_RANGE_TYPE;
Copy link

@itaibaz itaibaz Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SAI does support now range type to be s32list in table creation, so i think the work around can be removed, and pass in proper values #Resolved

@@ -1341,7 +1342,7 @@ sai_status_t AclOrch::bindAclTable(sai_object_id_t table_oid, AclTable &aclTable
auto& portAcls = m_portBind[portOid];

sai_attribute_t attr;
attr.id = SAI_PORT_ATTR_INGRESS_ACL_LIST;
attr.id = SAI_PORT_ATTR_INGRESS_ACL;
Copy link

@itaibaz itaibaz Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port Ingress ACL is no longer a list of objects (list of tables), it is a single object, either a table or a group
So seems a group should be created and bounded for each port
The following
// Port OID to vector of ACL OIDs
map <sai_object_id_t, vector<sai_object_id_t>> m_portBind;
Should be changed from vector to a single object #Resolved

attr.id = SAI_PORT_ATTR_FDB_LEARNING;
attr.value.s32 = SAI_PORT_LEARN_MODE_HW;
attr.id = SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE;
attr.value.s32 = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_HW;
Copy link

@itaibaz itaibaz Apr 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FDB learning mode is a bridge port attribute and not a port attribute
Here, set_port_attribute is used, which seems incorrect
Need to add a flow that after init : 1) gets default .1q bridge 2) read all bridge ports list 3) per bridge port reads the port ID 4) thus maintain a map between a port and bridge port
And then here to call the API on the relevant bridge port #Resolved

@qiluo-msft qiluo-msft force-pushed the qiluo/sai10 branch 2 times, most recently from 0f6f64d to cddc4e1 Compare April 14, 2017 01:04
@qiluo-msft
Copy link
Collaborator

initDefaultTrapGroup();

Is it a typo? SAI_HOST_INTERFACE_TABLE_ENTRY_CHANNEL_TYPE_PHYSICAL_NETDEV ==> SAI_HOSTIF_TABLE_ENTRY_CHANNEL_TYPE_NETDEV_PHYSICAL_PORT


In reply to: 293303275 [](ancestors = 293303275)


Refers to: orchagent/copporch.cpp:90 in 3ef44b5. [](commit_id = 3ef44b5, deletion_comment = False)

@itaibaz
Copy link

itaibaz commented Apr 14, 2017

SAI_HOSTIF_TABLE_ENTRY_CHANNEL_TYPE_NETDEV_PHYSICAL_PORT is the correct type #Resolved

@qiluo-msft
Copy link
Collaborator

Thanks for clarification!


In reply to: 294250108 [](ancestors = 294250108)

group_attrs[0].value.s32 = SAI_ACL_STAGE_INGRESS; // TODO: double check
group_attrs[1].id = SAI_ACL_TABLE_GROUP_ATTR_ACL_BIND_POINT_TYPE_LIST;
group_attrs[1].value.objlist.count = 1;
group_attrs[1].value.objlist.list[0] = SAI_ACL_BIND_POINT_TYPE_PORT;
Copy link

@andriymoroz-mlnx andriymoroz-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objlist.list is a pointer:

typedef struct _sai_object_list_t {
    uint32_t count;
    sai_object_id_t *list;
} sai_object_list_t;

you probably need to initialize it before assigning a value #Resolved

group_attrs[1].value.objlist.count = 1;
group_attrs[1].value.objlist.list[0] = SAI_ACL_BIND_POINT_TYPE_PORT;
group_attrs[2].id = SAI_ACL_TABLE_GROUP_ATTR_TYPE;
group_attrs[2].value.s32 = SAI_ACL_TABLE_GROUP_TYPE_SEQUENTIAL; // TODO: double check
Copy link

@andriymoroz-mlnx andriymoroz-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we've discussed whether the mirroring action should have precedence over the L3 table actions. And it was decided it should. So maybe you will need SAI_ACL_TABLE_GROUP_TYPE_PARALLEL here to let action "mirror" to be executed no matter of the "drop" action in another rule with the same match, for example.
@lguohan? #Resolved

SWSS_LOG_INFO("Set port %s VLAN ID to %hu", port.m_alias.c_str(), vlan.m_vlan_id);
// Create bridge ports and add ports to bridge
sai_object_id_t bport;
sai_attribute_t bport_attr[4];
Copy link

@andriymoroz-mlnx andriymoroz-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in other files:
using vector for sai attributes allows to avoid hard coding indexes and list size
also future extending will look much cleaner #Resolved

vm_attrs[0].id = SAI_VLAN_MEMBER_ATTR_VLAN_ID;
vm_attrs[0].value.u16 = vlan.m_vlan_id;
vm_attrs[1].id = SAI_VLAN_MEMBER_ATTR_BRIDGE_PORT_ID;
vm_attrs[1].value.oid = port.m_port_id;
Copy link

@vkochan-mlnx vkochan-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it should be "port.m_bridge_port_id" ? #Resolved

@@ -871,12 +879,12 @@ bool PortsOrch::addVlanMember(Port vlan, Port port)
attr.value.u16 = vlan.m_vlan_id;
attrs.push_back(attr);

attr.id = SAI_VLAN_MEMBER_ATTR_PORT_ID;
attr.id = SAI_VLAN_MEMBER_ATTR_BRIDGE_PORT_ID;
attr.value.oid = port.m_port_id;
Copy link

@vkochan-mlnx vkochan-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not it be "port.m_bridge_port_id" ? Also you need to be sure that LAG is under bridge (probably you need automatically to create it?), because LAG is not bridged after creation. #Resolved

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will not consider LAG under bridge scenario in SONiC.


In reply to: 112708538 [](ancestors = 112708538)

@@ -46,7 +47,7 @@ bool FdbOrch::getPort(const MacAddress& mac, uint16_t vlan, Port& port)
entry.vlan_id = vlan;

sai_attribute_t attr;
attr.id = SAI_FDB_ENTRY_ATTR_PORT_ID;
attr.id = SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID;
Copy link

@vkochan-mlnx vkochan-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make sure that you will correctly get a "class Port" instance by "bridge port id". #Resolved

nhg_attrs.push_back(nhg_attr);

nhg_attr.id = SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_LIST;
nhg_attr.id = SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_MEMBER_LIST;
Copy link

@vkochan-mlnx vkochan-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to check that eventually you created "SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER" objects
which should be specified into SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_MEMBER_LIST. #Resolved

Copy link

@itaibaz itaibaz Apr 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Vadym noted, SAI_NEXT_HOP_GROUP_ATTR_NEXT_HOP_MEMBER_LIST is read only attribute
When creating next hop group, you aren't giving the member list
Instead you create a next hop group
you create next hops
And then to add a next hop to group, you create a next hop group member
So seems the flow here should be
Create the next hop group without the list
Then, foreach next hop in next_hop_ids, create a next hop group member, given the group id and the next hop id #Resolved

Copy link

@itaibaz itaibaz Apr 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also seem to be missing a flow
When removing a next hop group, first need to remove all next hop group members that reference it
#Resolved

@@ -30,6 +30,7 @@ class PortsOrch : public Orch, public Subject

bool isInitDone();

map<string, Port>& getAllPorts();
bool getPort(string alias, Port &port);
bool getPort(sai_object_id_t id, Port &port);
Copy link

@vkochan-mlnx vkochan-mlnx Apr 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some places I noticed that getPort(oid, &port) is used for oid values obtained from XXX_BRIDGE_PORT_ID attribute,
it looks for me that it is needed to make additional check for sai_object_type_query(oid) == SAI_OBJECT_TYPE_BRIDGE_PORT and match oid parameter by "port.m_bridge_port_id" ? #Resolved

bport_attr[2].value.oid = m_default1QBridge;
bport_attr[3].id = SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE;
bport_attr[3].value.s32 = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_HW;
status = sai_bridge_api->create_bridge_port(&bport, gSwitchId, 4, bport_attr);
Copy link

@itaibaz itaibaz Apr 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is bridge port created here ?
for each port, there is a matching bridge port belonging to the .1q default bridge, on init
after reading the default .1q bridge, please read the bridge port list of it, then per bridge port read the port id, match to port obejct and add it this way
then, set the learning mode for the bridge port

the only time bridge port has to be created is when
splitting port (we aren't there yet)
creating new lag (add the lag to bridge)
removing port from lag (add back the port to bridge)
i think we are also missing then the lag use cases code

so when adding a port to vlan, no need to create bridge port, just use the matching bridge port for the port #Resolved

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved. Except relating LAG. We will not consider LAG under bridge scenario in SONiC.


In reply to: 112864196 [](ancestors = 112864196)

@@ -177,6 +178,11 @@ bool IntfsOrch::addRouterIntfs(Port &port)
return true;
}

if (port.m_type == Port::PHY)
Copy link

@itaibaz itaibaz Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before removing bridge port, the vlan member for that {bridge port, default vlan} should also be deleted #Resolved

@svc-acs svc-acs changed the title Adpat SAIv1.0 headers and fix compilation errors Adapt SAIv1.0 headers and fix compilation errors May 5, 2017
@qiluo-msft qiluo-msft changed the title Adapt SAIv1.0 headers and fix compilation errors Adapt SAI v1.0 headers Jun 3, 2017
lguohan pushed a commit that referenced this pull request Jan 29, 2020
* Fix the stack-overflow issue in AclOrch::getTableById()

In case the table_id and m_mirrorTableId/m_mirrorTableId are empty
The function would be called recursively without ending.

```
If we have some rule that does not have table defined, it will trigger this issue.

(gdb) bt
#0  0x00007f77ac5af3a9 in swss::Logger::write (this=0x7f77ac801ec0 <swss::Logger::getInstance()::m_logger>, prio=swss::Logger::SWSS_DEBUG, fmt=0x7f77ac5f1690 ":> %s: enter")
    at logger.cpp:209
#1  0x00000000004a5792 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2617
#2  0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
#3  0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
...
#20944 0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
#20945 0x00000000004ad3ce in AclOrch::doAclRuleTask (this=this@entry=0x1c722a0, consumer=...) at aclorch.cpp:2437
#20946 0x00000000004b04cd in AclOrch::doTask (this=0x1c722a0, consumer=...) at aclorch.cpp:2141
#20947 0x00000000004231b2 in Orch::doTask (this=0x1c722a0) at orch.cpp:369
#20948 0x000000000041c4e9 in OrchDaemon::start (this=this@entry=0x1c19960) at orchdaemon.cpp:376
#20949 0x0000000000409ffc in main (argc=<optimized out>, argv=0x7ffe2e392d68) at main.cpp:295

(gdb) p table_id
$1 = ""
(gdb) p m_mirrorTableId
$2 = ""
(gdb) p m_mirrorV6TableId
$3 = ""
```

Signed-off-by: Zhenggen Xu <[email protected]>
lguohan pushed a commit that referenced this pull request Apr 8, 2020
* Fix the stack-overflow issue in AclOrch::getTableById()

In case the table_id and m_mirrorTableId/m_mirrorTableId are empty
The function would be called recursively without ending.

```
If we have some rule that does not have table defined, it will trigger this issue.

(gdb) bt
#0  0x00007f77ac5af3a9 in swss::Logger::write (this=0x7f77ac801ec0 <swss::Logger::getInstance()::m_logger>, prio=swss::Logger::SWSS_DEBUG, fmt=0x7f77ac5f1690 ":> %s: enter")
    at logger.cpp:209
#1  0x00000000004a5792 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2617
#2  0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
#3  0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
...
#20944 0x00000000004a59d1 in AclOrch::getTableById (this=this@entry=0x1c722a0, table_id="") at aclorch.cpp:2634
#20945 0x00000000004ad3ce in AclOrch::doAclRuleTask (this=this@entry=0x1c722a0, consumer=...) at aclorch.cpp:2437
#20946 0x00000000004b04cd in AclOrch::doTask (this=0x1c722a0, consumer=...) at aclorch.cpp:2141
#20947 0x00000000004231b2 in Orch::doTask (this=0x1c722a0) at orch.cpp:369
#20948 0x000000000041c4e9 in OrchDaemon::start (this=this@entry=0x1c19960) at orchdaemon.cpp:376
#20949 0x0000000000409ffc in main (argc=<optimized out>, argv=0x7ffe2e392d68) at main.cpp:295

(gdb) p table_id
$1 = ""
(gdb) p m_mirrorTableId
$2 = ""
(gdb) p m_mirrorV6TableId
$3 = ""
```

Signed-off-by: Zhenggen Xu <[email protected]>
lguohan pushed a commit that referenced this pull request May 25, 2024
Currently, ASAN sometimes reports the BufferOrch::m_buffer_type_maps and QosOrch::m_qos_maps as leaked. However, their lifetime is the lifetime of a process so they are not really 'leaked'.
This also adds a simple way to add more suppressions later if required.

Example of ASAN report:

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f96aa952d30 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x55ca1da9f789 in __static_initialization_and_destruction_0 /__w/2/s/orchagent/bufferorch.cpp:39
    #2 0x55ca1daa02af in _GLOBAL__sub_I_bufferorch.cpp /__w/2/s/orchagent/bufferorch.cpp:1321
    #3 0x55ca1e2a9cd4  (/usr/bin/orchagent+0xe89cd4)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f96aa952d30 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x55ca1da6d2da in __static_initialization_and_destruction_0 /__w/2/s/orchagent/qosorch.cpp:80
    #2 0x55ca1da6ecf2 in _GLOBAL__sub_I_qosorch.cpp /__w/2/s/orchagent/qosorch.cpp:2000
    #3 0x55ca1e2a9cd4  (/usr/bin/orchagent+0xe89cd4)

- What I did
Added an lsan suppression config with static variable leak suppression

- Why I did it
To suppress ASAN false positives

- How I verified it
Run a test that produces the static variable leaks report and checked that report has these leaks suppressed.

Signed-off-by: Yakiv Huryk <[email protected]>
lguohan pushed a commit that referenced this pull request May 25, 2024
…onic-net#2446)

* Add events publish

* Added header file

* signature fix

* syntax

* syntax

* syntax

* syntax

* syntax

* syntax

* Updated fake code

* Remove if and log messages for event_publish

* Remove if and log messages for event_publish (#1)

* Remove event_handle_t from signature and add globally

* Remove extern orchdaemon.cpp

* Revert unneeded changes

Co-authored-by: zbud-msft <[email protected]>
Co-authored-by: Zain Budhwani <[email protected]>
lguohan pushed a commit that referenced this pull request May 25, 2024
**What I did**

Fix the Mem Leak by moving the raw pointers in type_maps to use smart pointers

**Why I did it**

```
Indirect leak of 83776 byte(s) in 476 object(s) allocated from:
    #0 0x7f0a2a414647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x5555590cc923 in __gnu_cxx::new_allocator, std::allocator > const, referenced_object> > >::allocate(unsigned long, void const*) /usr/include/c++/10/ext/new_allocator.h:115
    #2 0x5555590cc923 in std::allocator_traits, std::allocator > const, referenced_object> > > >::allocate(std::allocator, std::allocator > const, referenced_object> > >&, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:460
    #3 0x5555590cc923 in std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_get_node() /usr/include/c++/10/bits/stl_tree.h:584
    #4 0x5555590cc923 in std::_Rb_tree_node, std::allocator > const, referenced_object> >* std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_create_node, std::allocator > const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:634
    #5 0x5555590cc923 in std::_Rb_tree_iterator, std::allocator > const, referenced_object> > std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_emplace_hint_unique, std::allocator > const&>, std::tuple<> >(std::_Rb_tree_const_iterator, std::allocator > const, referenced_object> >, std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:2461
    #6 0x5555590e8757 in std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::operator[](std::__cxx11::basic_string, std::allocator > const&) /usr/include/c++/10/bits/stl_map.h:501
    #7 0x5555590d48b0 in Orch::setObjectReference(std::map, std::allocator >, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*, std::less, std::allocator > >, std::allocator, std::allocator > const, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*> > >&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) orchagent/orch.cpp:450
    sonic-net#8 0x5555594ff66b in QosOrch::handleQueueTable(Consumer&, std::tuple, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::vector, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator >, std::__cxx11::basic_string, std::allocator > > > > >&) orchagent/qosorch.cpp:1763
    sonic-net#9 0x5555594edbd6 in QosOrch::doTask(Consumer&) orchagent/qosorch.cpp:2179
    sonic-net#10 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:241
    sonic-net#11 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:238
    sonic-net#12 0x5555590c8743 in Consumer::execute() orchagent/orch.cpp:235
    sonic-net#13 0x555559090dad in OrchDaemon::start() orchagent/orchdaemon.cpp:755
    sonic-net#14 0x555558e9be25 in main orchagent/main.cpp:766
    sonic-net#15 0x7f0a299b6d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants