Move SystemBus init to early stage
The bmcweb crash issue seen when there is eventservice
config with subscriptions in persistent file.
During EventService instantiation, it uses the "get_io_context()"
from systemBus, so it should be called after systemBus init. So
moved systemBus initialization to early stage of main process to
avoid ordering issue.
Tested:
- bmcweb crash issue resolved.
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Change-Id: Iab52f0e89478e306af475066fb5691153a05677d
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index 960f591..902c32b 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -66,6 +66,9 @@
auto io = std::make_shared<boost::asio::io_context>();
App app(io);
+ crow::connections::systemBus =
+ std::make_shared<sdbusplus::asio::connection>(*io);
+
// Static assets need to be initialized before Authorization, because auth
// needs to build the whitelist from the static routes
@@ -113,9 +116,6 @@
setupSocket(app);
- crow::connections::systemBus =
- std::make_shared<sdbusplus::asio::connection>(*io);
-
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
crow::nbd_proxy::requestRoutes(app);
#endif