diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-09-19 13:19:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-09-19 18:28:33 +0200 |
commit | 6352710e02c12783280afccb3b5e03aab7948f19 (patch) | |
tree | 687d8f78ddf206f2917fc2120c9f183964b7458c /desktop/unx | |
parent | bbc07c964ef9a4698b3867ff554259adcf81bc58 (diff) |
try harder to remove "OSL_PIPE" pipe on SIGTERM
a) When oosplash got SIGTERM it used SIGKILL on soffice.bin, (concealed
behind osl_terminateProcess) so soffice.bin has no chance to cleanup.
Try SIGTERM, followed by SIGKILL if that doesn't work, to give
soffice.bin a chance.
b) java intercepts SIGTERM so if JNI_CreateJavaVM was called then
our SIGTERM handler doesn't get called. Add -Xrs to jvm args to
avoid this.
Change-Id: I09f93d8093bc7c094482eda73b4eadc5a6cebb83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140152
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'desktop/unx')
-rw-r--r-- | desktop/unx/source/start.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index f959565665cc..ca2579c33a18 100644 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -722,8 +722,23 @@ static void sigterm_handler(int ignored) (void) ignored; if (g_pProcess) { - osl_terminateProcess(g_pProcess); // forward signal to soffice.bin - osl_joinProcess(g_pProcess); + int SigTermSucceded = 0; + oslProcessInfo info; + info.Size = sizeof(oslProcessInfo); + + // forward SIGTERM to soffice.bin and give it a chance to semi-gracefully exit + // enough to remove named pipe + if (osl_getProcessInfo(g_pProcess, osl_Process_IDENTIFIER, &info) == osl_Process_E_None) { + TimeValue delay = { 1, 0 }; // 1 sec + SigTermSucceded = kill(info.Ident, SIGTERM) == 0 && + osl_joinProcessWithTimeout(g_pProcess, &delay) == osl_Process_E_None; + } + + // didn't work, SIGKILL instead + if (!SigTermSucceded) { + osl_terminateProcess(g_pProcess); // uses SIGKILL to terminate soffice.bin + osl_joinProcess(g_pProcess); + } } _exit(255); |