Skip to content

Commit 2005735

Browse files
liuh-80saksarav-nokia
authored andcommitted
Send hearbeat during warm reboot freese (sonic-net#2923)
*Orchagent send heartbeat during warm-reboot to prevent Orchagent stuck alert.
1 parent d6f5196 commit 2005735

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

orchagent/orchdaemon.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ void OrchDaemon::start()
865865
flush();
866866

867867
SWSS_LOG_WARN("Orchagent is frozen for warm restart!");
868-
sleep(UINT_MAX);
868+
freezeAndHeartBeat(UINT_MAX);
869869
}
870870
}
871871
}
@@ -1034,6 +1034,19 @@ void OrchDaemon::heartBeat(std::chrono::time_point<std::chrono::high_resolution_
10341034
}
10351035
}
10361036

1037+
void OrchDaemon::freezeAndHeartBeat(unsigned int duration)
1038+
{
1039+
while (duration > 0)
1040+
{
1041+
// Send heartbeat message to prevent Orchagent stuck alert.
1042+
auto tend = std::chrono::high_resolution_clock::now();
1043+
heartBeat(tend);
1044+
1045+
duration--;
1046+
sleep(1);
1047+
}
1048+
}
1049+
10371050
FabricOrchDaemon::FabricOrchDaemon(DBConnector *applDb, DBConnector *configDb, DBConnector *stateDb, DBConnector *chassisAppDb, ZmqServer *zmqServer) :
10381051
OrchDaemon(applDb, configDb, stateDb, chassisAppDb, zmqServer),
10391052
m_applDb(applDb),

orchagent/orchdaemon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class OrchDaemon
101101
void flush();
102102

103103
void heartBeat(std::chrono::time_point<std::chrono::high_resolution_clock> tcurrent);
104+
105+
void freezeAndHeartBeat(unsigned int duration);
104106
};
105107

106108
class FabricOrchDaemon : public OrchDaemon

0 commit comments

Comments
 (0)