Fix: PFR D-Bus introspect timeout error
Request bus name on connection will do a phosphor-mapper
introspect. If there is delay between io->run and request_name
causes the phosphor-mapper introspect failure. Due to this timing
issue, some times PFR version interfaces are not advertised over
D-Bus resulting in unavailability of version objects.
Moved request_name close to the io->run. Also isolated all signal
matchers from main.
Tested:
No timeout messages observed. Also Refish inventory items
populates all versions properly.
Change-Id: I18003e3ad0f6fa8821a4ec35a80cad017b3208c9
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index c71e78e..ae80912 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -329,31 +329,9 @@
"org.freedesktop.systemd1.Manager", "FinishTimestamp");
}
-int main()
+void monitorSignals(sdbusplus::asio::object_server& server,
+ std::shared_ptr<sdbusplus::asio::connection>& conn)
{
- // setup connection to dbus
- boost::asio::io_service io;
- auto conn = std::make_shared<sdbusplus::asio::connection>(io);
- stateTimer = std::make_unique<boost::asio::steady_timer>(io);
- initTimer = std::make_unique<boost::asio::steady_timer>(io);
- conn->request_name("xyz.openbmc_project.PFR.Manager");
- auto server = sdbusplus::asio::object_server(conn, true);
- auto rootInterface = server.add_interface("/xyz/openbmc_project/pfr", "");
- rootInterface->initialize();
- server.add_manager("/xyz/openbmc_project/pfr");
-
- // Create PFR attributes object and interface
- pfrConfigObject = std::make_unique<intel::pfr::PfrConfig>(server, conn);
-
- pfrVersionObjects.clear();
- // Create Software objects using Versions interface
- for (const auto& entry : verComponentList)
- {
- pfrVersionObjects.emplace_back(std::make_unique<intel::pfr::PfrVersion>(
- server, conn, std::get<0>(entry), std::get<1>(entry),
- std::get<2>(entry)));
- }
-
// Monitor Boot finished signal and set the checkpoint 9 to
// notify CPLD about BMC boot finish.
auto bootFinishedSignal = std::make_unique<sdbusplus::bus::match::match>(
@@ -501,10 +479,36 @@
// First time, check and log events if any.
checkAndLogEvents();
+}
+int main()
+{
+ // setup connection to dbus
+ boost::asio::io_service io;
+ auto conn = std::make_shared<sdbusplus::asio::connection>(io);
+ stateTimer = std::make_unique<boost::asio::steady_timer>(io);
+ initTimer = std::make_unique<boost::asio::steady_timer>(io);
+ auto server = sdbusplus::asio::object_server(conn, true);
+ monitorSignals(server, conn);
+
+ auto rootInterface = server.add_interface("/xyz/openbmc_project/pfr", "");
+ rootInterface->initialize();
+ server.add_manager("/xyz/openbmc_project/pfr");
+
+ // Create PFR attributes object and interface
+ pfrConfigObject = std::make_unique<intel::pfr::PfrConfig>(server, conn);
+
+ // Create Software objects using Versions interface
+ for (const auto& entry : verComponentList)
+ {
+ pfrVersionObjects.emplace_back(std::make_unique<intel::pfr::PfrVersion>(
+ server, conn, std::get<0>(entry), std::get<1>(entry),
+ std::get<2>(entry)));
+ }
+
+ conn->request_name("xyz.openbmc_project.PFR.Manager");
phosphor::logging::log<phosphor::logging::level::INFO>(
"Intel PFR service started successfully");
-
io.run();
return 0;