mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-05-31 09:21:12 +00:00
raise alarm on deadlock
This commit is contained in:
parent
0194f1d5bf
commit
6bc408e35a
2 changed files with 34 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2022-06-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* EcProcess.m: Intercept lock error handling and, in the case of a
|
||||||
|
deadlock, raise an alarm before calling the normal handler to log
|
||||||
|
and stop the thread.
|
||||||
|
|
||||||
2022-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
2022-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* GNUMakefile: Fix to supply local flags to build libraries
|
* GNUMakefile: Fix to supply local flags to build libraries
|
||||||
|
|
28
EcProcess.m
28
EcProcess.m
|
@ -81,6 +81,29 @@
|
||||||
NSString * const EcDidQuitNotification = @"EcDidQuitNotification";
|
NSString * const EcDidQuitNotification = @"EcDidQuitNotification";
|
||||||
NSString * const EcWillQuitNotification = @"EcWillQuitNotification";
|
NSString * const EcWillQuitNotification = @"EcWillQuitNotification";
|
||||||
|
|
||||||
|
static NSLock_error_handler *original_NSLock_error_handler = NULL;
|
||||||
|
static void
|
||||||
|
EcLock_error_handler(id obj, SEL _cmd, BOOL stop, NSString *msg)
|
||||||
|
{
|
||||||
|
if (stop && EcProc)
|
||||||
|
{
|
||||||
|
EcAlarm *a;
|
||||||
|
|
||||||
|
a = [EcAlarm alarmForManagedObject: nil
|
||||||
|
at: nil
|
||||||
|
withEventType: EcAlarmEventTypeProcessingError
|
||||||
|
probableCause: EcAlarmSoftwareProgramError
|
||||||
|
specificProblem: @"thread deadlock"
|
||||||
|
perceivedSeverity: EcAlarmSeverityCritical
|
||||||
|
proposedRepairAction:
|
||||||
|
_(@"Generate/save a core dump and then restart the process.")
|
||||||
|
additionalText: [obj description]];
|
||||||
|
[EcProc alarm: a];
|
||||||
|
}
|
||||||
|
(original_NSLock_error_handler)(obj, _cmd, stop, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef __MINGW__
|
#ifndef __MINGW__
|
||||||
static int reservedPipe[2] = { 0, 0 };
|
static int reservedPipe[2] = { 0, 0 };
|
||||||
static NSInteger descriptorsMaximum = 0;
|
static NSInteger descriptorsMaximum = 0;
|
||||||
|
@ -3175,6 +3198,11 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
|
if (NULL == original_NSLock_error_handler)
|
||||||
|
{
|
||||||
|
original_NSLock_error_handler = _NSLock_error_handler;
|
||||||
|
_NSLock_error_handler = EcLock_error_handler;
|
||||||
|
}
|
||||||
if (nil == ecLock)
|
if (nil == ecLock)
|
||||||
{
|
{
|
||||||
#if GS_USE_GNUTLS
|
#if GS_USE_GNUTLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue