Skip to content

Commit

Permalink
6.4.9-rc2 (#1364)
Browse files Browse the repository at this point in the history
MACOS_ONLY - Don't lock up app on close
- Improve internal logging
  • Loading branch information
tmolitor-stud-tu authored Jan 8, 2025
2 parents 7d83e64 + 4851c91 commit b834631
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/create-stable-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ jobs:
body: `${{ steps.get_commits.outputs.description }}`,
});
console.log(`Created pull request #${pullRequest.data.number}`);
//update pr after creation to trigger our pr-semver-title workflow
pullRequest = await github.rest.pulls.update({
owner,
repo,
pull_number: pullRequest.data.number,
title: `${{ steps.get_commits.outputs.buildVersion }}`,
body: `${{ steps.get_commits.outputs.description }}`,
});
console.log(`Updated pull request #${pullRequest.data.number}`);
}
return pullRequest.data.number;
- name: Add Label to Pull Request
Expand Down
1 change: 1 addition & 0 deletions Monal/Classes/HelperTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void swizzle(Class c, SEL orig, SEL new);
+(BOOL) isAppSuspended;
+(void) signalSuspension;
+(void) signalResumption;
+(void) activateTerminationLogging;
+(void) __attribute__((noreturn)) MLAssertWithText:(NSString*) text andUserData:(id _Nullable) additionalData andFile:(const char* const) file andLine:(int) line andFunc:(const char* const) func;
+(void) __attribute__((noreturn)) handleRustPanicWithText:(NSString*) text andBacktrace:(NSString*) backtrace;
+(void) __attribute__((noreturn)) throwExceptionWithName:(NSString*) name reason:(NSString*) reason userInfo:(NSDictionary* _Nullable) userInfo;
Expand Down
25 changes: 22 additions & 3 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ -(void) swizzled_queueLogMessage:(DDLogMessage*) logMessage asynchronously:(BOOL
#pragma pack()


void exitLogging(void)
{
DDLogInfo(@"exit() was called...");
//make sure to unfreeze logging before flushing everything and terminating
[self activateTerminationLogging];
[HelperTools flushLogsWithTimeout:0.025];
return;
}

// see: https://developer.apple.com/library/archive/qa/qa1361/_index.html
// Returns true if the current process is being debugged (either
// running under the debugger or has a debugger attached post facto).
Expand Down Expand Up @@ -422,10 +431,8 @@ +(void) __attribute__((noreturn)) handleRustPanicWithText:(NSString*) text andBa
_crash_info.backtrace = backtrace.UTF8String;

//log error and flush all logs
[DDLog flushLog];
DDLogError(@"*****************\n%@\n%@", abort_msg, backtrace);
[DDLog flushLog];
[HelperTools flushLogsWithTimeout:0.250];
[HelperTools flushLogsWithTimeout:0.025];

//now abort everything
abort();
Expand Down Expand Up @@ -1989,6 +1996,18 @@ +(void) signalResumption
}
}

+(void) activateTerminationLogging
{
@synchronized(_suspensionHandling_lock) {
if(_suspensionHandling_isSuspended)
{
DDLogVerbose(@"Activating logging for app termination...");
dispatch_resume([DDLog loggingQueue]);
_suspensionHandling_isSuspended = NO;
}
}
}

+(void) configureXcodeLogging
{
//only start console logger
Expand Down
2 changes: 0 additions & 2 deletions Monal/Classes/MLStreamRedirect.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ -(void) flushWithWaitBlock:(monal_void_block_t) waitBlock
DDLogVerbose(@"Waiting for flush of fd %d to complete...", fileno(self->_stream));
waitBlock();
DDLogVerbose(@"Flush on fd %d completed...", fileno(self->_stream));
[DDLog flushLog];
}

-(void) flushAndCloseWithWaitBlock:(monal_void_block_t) waitBlock
Expand All @@ -163,7 +162,6 @@ -(void) flushAndCloseWithWaitBlock:(monal_void_block_t) waitBlock

//wait for this eof signal and flush our DDLog afterwards to make sure everything reached the log sinks
waitBlock();
[DDLog flushLog];
}

-(void) signalFlushCompleted
Expand Down
10 changes: 5 additions & 5 deletions Monal/Classes/MonalAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1263,21 +1263,22 @@ -(void) applicationDidEnterBackground:(UIApplication*) application
#endif
}

-(void) applicationWillTerminate:(UIApplication *)application
-(void) applicationWillTerminate:(UIApplication*) application
{
@synchronized(self) {
[HelperTools activateTerminationLogging]; //activate logging during shutdown
DDLogVerbose(@"Setting _shutdownPending to YES...");
_shutdownPending = YES;
DDLogWarn(@"|~~| T E R M I N A T I N G |~~|");
[HelperTools scheduleBackgroundTask:YES]; //make sure delivery will be attempted, if needed (force as soon as possible)
[HelperTools scheduleBackgroundTask:YES]; //make sure delivery will be attempted, if needed (force as soon as possible)
DDLogInfo(@"|~~| 33%% |~~|");
[[MLXMPPManager sharedInstance] nowBackgrounded];
DDLogInfo(@"|~~| 66%% |~~|");
[HelperTools updateSyncErrorsWithDeleteOnly:NO andWaitForCompletion:YES];
DDLogInfo(@"|~~| 99%% |~~|");
[[MLXMPPManager sharedInstance] disconnectAll];
DDLogInfo(@"|~~| T E R M I N A T E D |~~|");
[DDLog flushLog];
[HelperTools activateTerminationLogging]; //ensure our flush is really successful
[HelperTools flushLogsWithTimeout:0.025];
}
}
Expand Down Expand Up @@ -1440,7 +1441,6 @@ -(void) checkIfBackgroundTaskIsStillNeeded
if(background)
{
DDLogInfo(@"### All accounts idle, disconnecting and stopping all background tasks ###");
[DDLog flushLog];
DDLogVerbose(@"Setting _shutdownPending to YES...");
_shutdownPending = YES;
[HelperTools scheduleBackgroundTask:NO]; //request bg fetch execution in BGFETCH_DEFAULT_INTERVAL seconds
Expand Down Expand Up @@ -1483,7 +1483,7 @@ -(void) checkIfBackgroundTaskIsStillNeeded
}
if(!stopped)
{
DDLogDebug(@"no background tasks running, nothing to stop");
DDLogError(@"no background tasks running, nothing to stop");
[DDLog flushLog];
}
else
Expand Down
2 changes: 0 additions & 2 deletions Monal/NotificationService/NotificationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ -(void) killAppex
[NotificationService setAppexCleanShutdownStatus:YES];

DDLogInfo(@"Now killing appex process, goodbye...");
[HelperTools flushLogsWithTimeout:0.100];
exit(0);
}

Expand Down Expand Up @@ -605,7 +604,6 @@ -(void) serviceExtensionTimeWillExpire
#endif

DDLogInfo(@"Committing suicide...");
[DDLog flushLog];
exit(0);

/*
Expand Down

0 comments on commit b834631

Please sign in to comment.