Skip to content

Commit 38e58eb

Browse files
committed
Fix issue: OA isn't aborted on receiving shutdown after fatal event
Signed-off-by: Stephen Sun <stephens@nvidia.com>
1 parent 29c9ee7 commit 38e58eb

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

orchagent/notifications.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ void on_switch_shutdown_request(sai_object_id_t switch_id)
3737
/* TODO: Later a better restart story will be told here */
3838
SWSS_LOG_ERROR("Syncd stopped");
3939

40+
if (gSwitchOrch->isFatalEventReceived())
41+
{
42+
abort();
43+
}
44+
4045
/*
4146
The quick_exit() is used instead of the exit() to avoid a following data race:
4247
* the exit() calls the destructors for global static variables (e.g.BufferOrch::m_buffer_type_maps)

orchagent/switchorch.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,11 @@ void SwitchOrch::onSwitchAsicSdkHealthEvent(sai_object_id_t switch_id,
11211121
m_asicSdkHealthEventTable->set(time_ss.str(),values);
11221122

11231123
event_publish(g_events_handle, "asic-sdk-health-event", &params);
1124+
1125+
if (severity == SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL)
1126+
{
1127+
m_fatalEventCount++;
1128+
}
11241129
}
11251130

11261131
bool SwitchOrch::setAgingFDB(uint32_t sec)

orchagent/switchorch.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class SwitchOrch : public Orch
5858
sai_switch_asic_sdk_health_category_t category,
5959
sai_switch_health_data_t data,
6060
const sai_u8_list_t &description);
61+
62+
inline bool isFatalEventReceived() const
63+
{
64+
return (m_fatalEventCount != 0);
65+
}
66+
6167
private:
6268
void doTask(Consumer &consumer);
6369
void doTask(swss::SelectableTimer &timer);
@@ -120,6 +126,7 @@ class SwitchOrch : public Orch
120126
std::set<sai_switch_attr_t> m_supportedAsicSdkHealthEventAttributes;
121127
std::string m_eliminateEventsSha;
122128
swss::SelectableTimer* m_eliminateEventsTimer = nullptr;
129+
uint32_t m_fatalEventCount = 0;
123130

124131
void initAsicSdkHealthEventNotification();
125132
sai_status_t registerAsicSdkHealthEventCategories(sai_switch_attr_t saiSeverity, const std::string &severityString, const std::string &suppressed_category_list="");

0 commit comments

Comments
 (0)