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

[SFLOW] Failed to breakout due to configure Sflow #6

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

chiourung
Copy link

There are chances the the port has not been created in SAI and handling on the new created port for sflow goes the SAI port creation when dynamic port breakout command is executed. It needs to wait port ready before setting sflow on the port.

There are chances that the port has not been created and handling on the new created port for sflow when dynamic port breakout command is executed. It needs to wait port ready before setting sflow on the port.

Sometimes swss would dead when enable sflow and do port breakout,

May 24 02:04:34.033589 sonic INFO ConfigMgmt: Write in DB: {'INTERFACE': {'Ethernet48': None, ('Ethernet48', '10.0.0.96/31'): None}, 'PORT': {'Ethernet48': None}, 'SFLOW_SESSION': {'Ethernet48': None}}
May 24 02:04:36.046650 sonic INFO ConfigMgmt: Write in DB: {'PORT': {'Ethernet48': {'alias': 'Eth49/1(Port49)', 'lanes': '37', 'speed': '25000', 'index': '49','parent_port': 'Ethernet48'}, 'Ethernet49': {'alias': 'Eth49/2(Port49)', 'lanes': '38', 'speed': '25000', 'index': '49','parent_port': 'Ethernet48'}, 'Ethernet50': {'alias': 'Eth49/3(Port49)', 'lanes': '39', 'speed': '25000', 'index': '49', 'parent_port': 'Ethernet48'},'Ethernet51': {'alias': 'Eth49/4(Port49)', 'lanes': '40', 'speed': '25000', 'index': '49', 'parent_port': 'Ethernet48'}}}
May 24 02:04:36.054081 sonic ERR swss#orchagent: :- set: switch id oid:0x0 doesn't exist
May 24 02:04:36.054540 sonic ERR swss#orchagent: :- sflowAddPort: Failed to set session f000000000a06 on port 0
May 24 02:04:36.054540 sonic ERR swss#orchagent: :- handleSaiSetStatus: Encountered failure in set operation, exiting orchagent, SAI API: SAI_API_PORT, status: SAI_STATUS_INVALID_PARAMETER

What I did
Wait until port is created successfully when sflow is set for port.

Why I did it
It should get correct port ID when set sflow for port.

How I verified it

  1. enable sflow
  2. breakout port
  3. make sure swss work well
root@sonic:/# config sflow enable
root@sonic:/# config sflow collector add test 188.188.87.120
root@sonic:/# config sflow interface enable Ethernet480
root@sonic:/# config interface breakout Ethernet480 1x400G -f -y

Running Breakout Mode : 1x100G[40G](4)
Target Breakout Mode : 1x400G

Ports to be deleted :
 {
    "Ethernet480": "100000"
}
Ports to be added :
 {
    "Ethernet480": "400000"
}

After running Logic to limit the impact

Final list of ports to be deleted :
 {
    "Ethernet480": "100000"
}
Final list of ports to be added :
 {
    "Ethernet480": "400000"
}
sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY, XCVRD_LOG
Breakout process got successfully completed.
Please note loaded setting will be lost after system reboot. To preserve setting, run `config save`.
root@sonic:/# docker ps
CONTAINER ID   IMAGE                                COMMAND                  CREATED       STATUS       PORTS     NAMES
0a067666242d   docker-snmp:latest                   "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             snmp
7c5fdf312b7e   docker-sonic-telemetry:latest        "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             telemetry
511a035536c2   docker-sonic-mgmt-framework:latest   "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             mgmt-framework
a10d1f0f41f6   656d607218cd                         "/usr/bin/docker_ini…"   6 hours ago   Up 5 hours             dhcp_relay
336087158a63   docker-router-advertiser:latest      "/usr/bin/docker-ini…"   6 hours ago   Up 5 hours             radv
53582ba9a454   docker-stp:latest                    "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             stp
bf0c1ccaf978   docker-lldp:latest                   "/usr/bin/docker-lld…"   6 hours ago   Up 5 hours             lldp
68b9607dbb6d   docker-sflow:latest                  "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             sflow
8a40a1815a9a   docker-nat:latest                    "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             nat
bbe128d46ac9   docker-syncd-brcm:latest             "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             syncd
64655f48c833   docker-teamd:latest                  "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             teamd
5eeb5a6d7f91   docker-sonic-p4rt:latest             "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             p4rt
9823b8fc5fbf   docker-iccpd:latest                  "/usr/local/bin/supe…"   6 hours ago   Up 5 hours             iccpd
4f8359ee47a6   docker-orchagent:latest              "/usr/bin/docker-ini…"   6 hours ago   Up 5 hours             swss
208f5cb495ad   docker-fpm-frr:latest                "/usr/bin/docker_ini…"   6 hours ago   Up 5 hours             bgp
f6ac8af3b17f   docker-platform-monitor:latest       "/usr/bin/docker_ini…"   6 hours ago   Up 5 hours             pmon
a0e6dbce950e   docker-database:latest               "/usr/local/bin/dock…"   6 hours ago   Up 5 hours             database
root@sonic:/#
root@sonic:/# show interfaces status Ethernet480
  Interface                            Lanes    Speed    MTU    Oper FEC          Alias    Vlan    Oper    Admin    ProtoDown    Eff Admin    Type    Asym PFC    Oper Speed
-----------  -------------------------------  -------  -----  ----------  -------------  ------  ------  -------  -----------  -----------  ------  ----------  ------------
Ethernet480  386,387,388,389,390,391,392,393     400G   9100          rs  Eth61(Port61)  routed    down     down        False          N/A     N/A         N/A          400G
root@sonic:/#

Details if related

There are chances the the port has not been created in SAI and
handling on the new created port for sflow goes the SAI port creation
when dynamic port breakout command is executed. It needs to wait port
ready before setting sflow on the port.

Signed-off-by: chiourung_huang <[email protected]>
@PJHsieh PJHsieh merged commit 5081dfb into edge-core:202311.X Jul 8, 2024
1 check passed
link19430 pushed a commit to link19430/sonic-swss-ec that referenced this pull request Aug 13, 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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#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
    edge-core#9 0x5555594edbd6 in QosOrch::doTask(Consumer&) orchagent/qosorch.cpp:2179
    edge-core#10 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:241
    edge-core#11 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:238
    edge-core#12 0x5555590c8743 in Consumer::execute() orchagent/orch.cpp:235
    edge-core#13 0x555559090dad in OrchDaemon::start() orchagent/orchdaemon.cpp:755
    edge-core#14 0x555558e9be25 in main orchagent/main.cpp:766
    edge-core#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.

2 participants