diff --git a/.github/workflows/create-stable-pr.yml b/.github/workflows/create-stable-pr.yml index 3d93a958b..104ccab41 100644 --- a/.github/workflows/create-stable-pr.yml +++ b/.github/workflows/create-stable-pr.yml @@ -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 diff --git a/Monal/Classes/HelperTools.h b/Monal/Classes/HelperTools.h index 050be3d85..17455062c 100644 --- a/Monal/Classes/HelperTools.h +++ b/Monal/Classes/HelperTools.h @@ -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; diff --git a/Monal/Classes/HelperTools.m b/Monal/Classes/HelperTools.m index 88af31c39..eee3665fd 100644 --- a/Monal/Classes/HelperTools.m +++ b/Monal/Classes/HelperTools.m @@ -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). @@ -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(); @@ -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 diff --git a/Monal/Classes/MLStreamRedirect.m b/Monal/Classes/MLStreamRedirect.m index b075622ec..6fc520764 100644 --- a/Monal/Classes/MLStreamRedirect.m +++ b/Monal/Classes/MLStreamRedirect.m @@ -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 @@ -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 diff --git a/Monal/Classes/MonalAppDelegate.m b/Monal/Classes/MonalAppDelegate.m index 2021c43b2..56e5e0924 100644 --- a/Monal/Classes/MonalAppDelegate.m +++ b/Monal/Classes/MonalAppDelegate.m @@ -1263,13 +1263,14 @@ -(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%% |~~|"); @@ -1277,7 +1278,7 @@ -(void) applicationWillTerminate:(UIApplication *)application 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]; } } @@ -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 @@ -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 diff --git a/Monal/NotificationService/NotificationService.m b/Monal/NotificationService/NotificationService.m index 8a514773f..36ab98259 100644 --- a/Monal/NotificationService/NotificationService.m +++ b/Monal/NotificationService/NotificationService.m @@ -133,7 +133,6 @@ -(void) killAppex [NotificationService setAppexCleanShutdownStatus:YES]; DDLogInfo(@"Now killing appex process, goodbye..."); - [HelperTools flushLogsWithTimeout:0.100]; exit(0); } @@ -605,7 +604,6 @@ -(void) serviceExtensionTimeWillExpire #endif DDLogInfo(@"Committing suicide..."); - [DDLog flushLog]; exit(0); /*