Reg sdbusplus - async handlers - D-Bus error not getting reflected

Thomaiyar, Richard Marian richard.marian.thomaiyar at linux.intel.com
Wed Jun 26 02:18:32 AEST 2019


Hi,

In sdbusplus code, async_send_handler callback() uses the 
sdbusplus::message::message.get_errorno() 
https://github.com/openbmc/sdbusplus/blob/master/sdbusplus/asio/detail/async_send_handler.hpp#L66 
function to instantiate the boost::system::error_code. Unfortunately, 
none of our D-Bus exception throwing functionality sets the error_no to 
a proper one, but instead updates only the error_message field 
https://github.com/openbmc/sdbusplus/blob/master/tools/sdbusplus/templates/method.mako.prototype.hpp.in#L171 
causing the error_code instance to always return a generic error code 
value, instead of a proper one. Because of this applications which uses 
the asio logic will not be able to differentiate between exceptions 
thrown / errors from D-Bus.

Planning to fix the same in 2 step,

1. To make all D-Bus exception to set the errorno properly using 
sd_bus_error_set_errno and getting the error from the yaml if available 
else return generic one (so that no change in existing daemon will be 
required).

2. make change in async_send_handler_callaback, such that derived class 
of boost::system::error_code is returned, which will hold the error 
message too. Any daemon which uses asio logic, can depend on ec.value() 
as primary exception identifier or ec.message() for any detailed 
exception thrown.

Let me know your thoughts , and if agree, will start implementing the same.

Regards,

Richard



More information about the openbmc mailing list