sonic-net/sonic-swss

Orchagent crashed with SEGV when Flexcounter enabled for queue watermark, pg-drop

rajkumar38 opened this issue · 1 comments

Below crash is observed on platforms that are not supporting queue-watermark and pg-drop statistics.
Issue introduced with PR #2883

Back-trace:

Reading symbols from /usr/bin/orchagent...
Reading symbols from /usr/lib/debug/.build-id/48/c447dca41af351f964c7f81f2333d74eed6037.debug...
bt[New LWP 44]
[New LWP 82]
[New LWP 80]
[New LWP 83]
[New LWP 85]
[New LWP 86]
[New LWP 84]
[New LWP 148]
[New LWP 149]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/bin/orchagent -d /var/log/swss -b 1024 -s -m 00:51:82:11:22:00'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000aaaadb3d0e48 in std::_Bit_reference::operator= (__x=true, this=<optimized out>) at /usr/include/c++/10/bits/stl_bvector.h:93
93      /usr/include/c++/10/bits/stl_bvector.h: No such file or directory.
[Current thread is 1 (Thread 0xffffb2956690 (LWP 44))]
(gdb) bt
#0  0x0000aaaadb3d0e48 in std::_Bit_reference::operator= (__x=true, this=<optimized out>) at /usr/include/c++/10/bits/stl_bvector.h:93
#1  FlexCounterPgStates::enablePgCounter (this=this@entry=0xffffca3fe158, pgIndex=pgIndex@entry=0) at flexcounterorch.cpp:529
#2  0x0000aaaadb3d0eec in FlexCounterPgStates::enablePgCounters (this=this@entry=0xffffca3fe158, startIndex=startIndex@entry=0,
    endIndex=endIndex@entry=4294967295) at flexcounterorch.cpp:522
#3  0x0000aaaadb242504 in PortsOrch::generatePriorityGroupMap (this=this@entry=0xaaab0d8df6c0, pgsStateVector=std::map with 0 elements)
    at portsorch.cpp:6752
#4  0x0000aaaadb3d4f04 in FlexCounterOrch::doTask (this=0xaaab0d8c7ae0, consumer=...) at flexcounterorch.cpp:178
#5  0x0000aaaadb1bc400 in Orch::doTask (this=0xaaab0d8c7ae0) at orch.cpp:532
#6  0x0000aaaadb1b1358 in OrchDaemon::start (this=this@entry=0xaaab0d8b2250) at orchdaemon.cpp:833
#7  0x0000aaaadb1313e4 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:769

@rajkumar38 I've analyze an issue and found a bug, I will raise a PR with fixes