Skip to content

Commit 3ab2f07

Browse files
authored
Graceful shutdown vpp to avoid core dump (#1714)
Signed-off-by: Yue Gao <[email protected]>
1 parent a5e0e63 commit 3ab2f07

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

vslib/vpp/SwitchVpp.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ SwitchVpp::SwitchVpp(
3939
vpp_dp_initialize();
4040
}
4141

42+
SwitchVpp::~SwitchVpp()
43+
{
44+
SWSS_LOG_ENTER();
45+
46+
// Signal the vpp events thread to stop
47+
m_run_vpp_events_thread = false;
48+
49+
// Wait for the thread to finish gracefully
50+
if (m_vpp_thread && m_vpp_thread->joinable()) {
51+
m_vpp_thread->join();
52+
}
53+
54+
SWSS_LOG_NOTICE("SwitchVpp destructor completed");
55+
}
56+
4257
sai_status_t SwitchVpp::create_qos_queues_per_port(
4358
_In_ sai_object_id_t port_id)
4459
{

vslib/vpp/SwitchVpp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace saivs
4141
_In_ std::shared_ptr<SwitchConfig> config,
4242
_In_ std::shared_ptr<WarmBootState> warmBootState);
4343

44-
virtual ~SwitchVpp() = default;
44+
virtual ~SwitchVpp();
4545

4646
protected:
4747

0 commit comments

Comments
 (0)