ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

IOCs: Crash when gracefully quit #3793

Open Alistair-McGann-Tessella opened 5 years ago

Alistair-McGann-Tessella commented 5 years ago

As a developer I have noticed that an IOC can segfault when an IOC is closed by logClientDestroy, which is called during a graceful shutdown of the IOC (not simply killing the process). This occured when there were many archive monitors on an IOC running in the IOC test framework.

I produced this problem by running the tests for this version of the fermi chopper, while I had an archive on two or three of the status MBBIDirect fields. When the IOC tests finished, the IOC crashed.

The debugging pointed to line 337 of logClient.c. The error message suggested that the values of pClient were invalid when this line was excecuted. pClient was not set to null. Could this be because pClient is being changed by the blocks during the if statement?

FreddieAkeroyd commented 5 years ago

You would need to look further back in the call stack, but my guess is that it came via caPutLog which was trying to log a message and the logger had already been removed by logClientDestroy. I think I can improve the caPutLog logic, it checks for "shutdown" and then waits with timeout for a message, it also/instead needs to do a "check for shutdown" after receiving a message as currently it could attempt to deliver to an invalid log client id.