Skip to content

Commit adaabd2

Browse files
committed
More race conditions for exit 128
1 parent bfa7c72 commit adaabd2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,10 @@ void DataProcessingDevice::InitTask()
982982
uv_signal_init(state.loop, deviceContext.sigusr1Handle);
983983
uv_signal_start(deviceContext.sigusr1Handle, on_signal_callback, SIGUSR1);
984984
}
985+
// If there is any signal, we want to make sure they are active
986+
for (auto& handle : state.activeSignals) {
987+
handle->data = &state;
988+
}
985989
// When we start, we must make sure that we do listen to the signal
986990
deviceContext.sigusr1Handle->data = &mServiceRegistry;
987991

@@ -1691,6 +1695,11 @@ void DataProcessingDevice::ResetTask()
16911695
if (deviceContext.sigusr1Handle) {
16921696
deviceContext.sigusr1Handle->data = nullptr;
16931697
}
1698+
// Makes sure we do not have a working context on
1699+
// shutdown.
1700+
for (auto& handle : ref.get<DeviceState>().activeSignals) {
1701+
handle->data = nullptr;
1702+
}
16941703
}
16951704

16961705
struct WaitBackpressurePolicy {

Framework/Core/src/DeviceSpecHelpers.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ void signal_callback(uv_signal_t* handle, int)
9090
{
9191
// We simply wake up the event loop. Nothing to be done here.
9292
auto* state = (DeviceState*)handle->data;
93+
if (!state) {
94+
return;
95+
}
9396
state->loopReason |= DeviceState::SIGNAL_ARRIVED;
9497
state->loopReason |= DeviceState::DATA_INCOMING;
9598
}

0 commit comments

Comments
 (0)