diff --git a/orchagent/notifications.cpp b/orchagent/notifications.cpp index e2b684a751..344ff4c961 100644 --- a/orchagent/notifications.cpp +++ b/orchagent/notifications.cpp @@ -37,6 +37,11 @@ void on_switch_shutdown_request(sai_object_id_t switch_id) /* TODO: Later a better restart story will be told here */ SWSS_LOG_ERROR("Syncd stopped"); + if (gSwitchOrch->isFatalEventReceived()) + { + abort(); + } + /* The quick_exit() is used instead of the exit() to avoid a following data race: * the exit() calls the destructors for global static variables (e.g.BufferOrch::m_buffer_type_maps) diff --git a/orchagent/switchorch.cpp b/orchagent/switchorch.cpp index 630955219c..859d0be20e 100644 --- a/orchagent/switchorch.cpp +++ b/orchagent/switchorch.cpp @@ -1121,6 +1121,11 @@ void SwitchOrch::onSwitchAsicSdkHealthEvent(sai_object_id_t switch_id, m_asicSdkHealthEventTable->set(time_ss.str(),values); event_publish(g_events_handle, "asic-sdk-health-event", ¶ms); + + if (severity == SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL) + { + m_fatalEventCount++; + } } bool SwitchOrch::setAgingFDB(uint32_t sec) diff --git a/orchagent/switchorch.h b/orchagent/switchorch.h index 92b5962178..bf915774d6 100644 --- a/orchagent/switchorch.h +++ b/orchagent/switchorch.h @@ -58,6 +58,12 @@ class SwitchOrch : public Orch sai_switch_asic_sdk_health_category_t category, sai_switch_health_data_t data, const sai_u8_list_t &description); + + inline bool isFatalEventReceived() const + { + return (m_fatalEventCount != 0); + } + private: void doTask(Consumer &consumer); void doTask(swss::SelectableTimer &timer); @@ -120,6 +126,7 @@ class SwitchOrch : public Orch std::set m_supportedAsicSdkHealthEventAttributes; std::string m_eliminateEventsSha; swss::SelectableTimer* m_eliminateEventsTimer = nullptr; + uint32_t m_fatalEventCount = 0; void initAsicSdkHealthEventNotification(); sai_status_t registerAsicSdkHealthEventCategories(sai_switch_attr_t saiSeverity, const std::string &severityString, const std::string &suppressed_category_list="");