File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -3630,6 +3630,10 @@ int syncd_main(int argc, char **argv)
3630
3630
onSyncdStart (options.startType == SAI_WARM_BOOT);
3631
3631
SWSS_LOG_NOTICE (" after onSyncdStart" );
3632
3632
3633
+ // create notifications processing thread after we create_switch to
3634
+ // make sure, we have switch_id translated to VID before we start
3635
+ // processing possible quick fdb notifications, and pointer for
3636
+ // notification queue is created before we create switch
3633
3637
startNotificationsProcessingThread ();
3634
3638
3635
3639
SWSS_LOG_NOTICE (" syncd listening for events" );
Original file line number Diff line number Diff line change @@ -458,6 +458,7 @@ std::condition_variable cv;
458
458
class ntf_queue_t
459
459
{
460
460
public:
461
+ ntf_queue_t () { }
461
462
bool enqueue (swss::KeyOpFieldsValuesTuple msg);
462
463
bool tryDequeue (swss::KeyOpFieldsValuesTuple& msg);
463
464
size_t queueStats ()
@@ -480,7 +481,15 @@ class ntf_queue_t
480
481
const size_t limit = 300000 ;
481
482
};
482
483
483
- static std::unique_ptr<ntf_queue_t > ntf_queue_hdlr;
484
+
485
+ /*
486
+ * Make sure that notification queue pointer is populated before we start
487
+ * thread, and before we create_switch, since at switch_create we can start
488
+ * receiving fdb_notifications which will arrive on different thread and
489
+ * will call queueStats() when queue pointer could be null (this=0x0).
490
+ */
491
+
492
+ static std::unique_ptr<ntf_queue_t > ntf_queue_hdlr = std::unique_ptr<ntf_queue_t >(new ntf_queue_t );
484
493
485
494
bool ntf_queue_t::tryDequeue (
486
495
_Out_ swss::KeyOpFieldsValuesTuple &item)
@@ -641,8 +650,6 @@ void ntf_process_function()
641
650
{
642
651
SWSS_LOG_ENTER ();
643
652
644
- ntf_queue_hdlr = std::unique_ptr<ntf_queue_t >(new ntf_queue_t );
645
-
646
653
while (runThread)
647
654
{
648
655
cv.wait (ulock);
You can’t perform that action at this time.
0 commit comments