bug: DrcProxyBase SIGABRTs during app stop() if drc config is inactive
The OA::Application stop() method can be called at anytime. When app stop() is called, a DRC worker's stop() method is called. The DrcProxyBase class extends the regular RCC Worker class and defines extra operations to occur during RCC Worker stop(), including a DRC-specific call to stop_config() (https://gitlab.com/opencpi/opencpi/-/blob/50c2ae42e023ce4ca7cd53d78b129431f0838e58/runtime/drc/base/include/OcpiDrcProxyApi.hh#L78). The stop_config() returns RCC_ERROR if the configuration ordinal is in an INACTIVE state (which is totally possible when app.stop() is called! especially after this change: cb6214aa (comment 1633479747)) and results in the following error printed to the screen:
OCPI( 8:343.0318): drc: STOPPING DRC PROXY CONFIGURATION: 0
OCPI( 2:343.0318): drc: Error: DRC proxy stopped a configuration in inactive mode.
terminate called after throwing an instance of 'OCPI::Util::EmbeddedException'
Aborted
%
I believe the right fix is to modify the stop() method to only call stop_config(ordinal) if the ordinal is not in INACTIVE, which I believe is safe to do. Users can get around this problem by overriding the stop() method in their own RCC worker code:
RCCResult stop() {
log(8, "STOPPING DRC PROXY");
size_t nConfigs = m_properties.configurations.size();
RCCResult rc;
for (size_t n = 0; n < nConfigs; ++n) {
if (m_properties.status.data[n].state != STATUS_STATE_INACTIVE)
if ((rc = DrcProxyBase::stop_config(n,true)))
return rc;
}
return RCC_OK;
}