Fix stop rx stuck (#669)

stop should really stop even if receiver had crashed, so check rx status after sending stop; also ensuring restream  in acquire happens only if thers a callback
This commit is contained in:
Dhanya Thattil 2023-02-20 15:21:22 +01:00 committed by GitHub
parent 878eab9fc3
commit fe281bd1b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 15 deletions

View File

@ -483,6 +483,12 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
to access shared memory without creating it first.
* Stop detector when receiver is stuck
If receiver was stuck or crashed, stop acquisition command should
stop detector first before checking receiver status to restream
dummy header. Fixed.
* Free and config command fail
Free and config command checked mismatch of size of shared memory before
freeing or loading new config. Fixed.

View File

@ -1224,8 +1224,7 @@ int DetectorImpl::acquire() {
// let the progress thread (no callback) know acquisition is done
if (dataReady == nullptr) {
setJoinThreadFlag(true);
}
if (receiver) {
} else if (receiver) {
while (numZmqRunning != 0) {
Parallel(&Module::restreamStopFromReceiver, {});
std::this_thread::sleep_for(std::chrono::milliseconds(200));
@ -1315,6 +1314,7 @@ void DetectorImpl::processData(bool receiver) {
}
// only update progress
else {
LOG(logINFO) << "Type 'q' and hit enter to stop";
double progress = 0;
printProgress(progress);

View File

@ -870,26 +870,25 @@ void Module::startReadout() {
}
void Module::stopAcquisition() {
// get status before stopping acquisition
runStatus s = ERROR, r = ERROR;
bool zmqstreaming = false;
// get det status before stopping acq
runStatus detStatus = ERROR;
try {
if (shm()->useReceiverFlag && getReceiverStreaming()) {
zmqstreaming = true;
s = getRunStatus();
r = getReceiverStatus();
}
detStatus = getRunStatus();
} catch (...) {
// if receiver crashed, stop detector in any case
zmqstreaming = false;
}
sendToDetectorStop(F_STOP_ACQUISITION);
shm()->stoppedFlag = true;
// if rxr streaming and acquisition finished, restream dummy stop packet
if (zmqstreaming && (s == IDLE) && (r == IDLE)) {
restreamStopFromReceiver();
// restream dummy header, if rxr streaming and det idle before stop
try {
if (shm()->useReceiverFlag && getReceiverStreaming()) {
if (detStatus == IDLE && getReceiverStatus() == IDLE) {
restreamStopFromReceiver();
}
}
} catch (...) {
}
}