Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion orchagent/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ extern "C" {
#include "logger.h"
#include "notifications.h"

#ifdef ASAN_ENABLED
#include <sanitizer/lsan_interface.h>
#endif

void on_fdb_event(uint32_t count, sai_fdb_event_notification_data_t *data)
{
// don't use this event handler, because it runs by libsairedis in a separate thread
Expand All @@ -30,5 +34,16 @@ 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");

exit(EXIT_FAILURE);
/*
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)
* in parallel to that, orchagent accesses the global static variables
Since quick_exit doesn't call atexit() flows, the LSAN check is called explicitly via __lsan_do_leak_check()
*/

#ifdef ASAN_ENABLED
__lsan_do_leak_check();
#endif

quick_exit(EXIT_FAILURE);
}