diff --git a/0001-tdf-95843-Wait-for-fire_glxtest_process-also-in-head.patch b/0001-tdf-95843-Wait-for-fire_glxtest_process-also-in-head.patch new file mode 100644 index 0000000..dd4f813 --- /dev/null +++ b/0001-tdf-95843-Wait-for-fire_glxtest_process-also-in-head.patch @@ -0,0 +1,126 @@ +From 0f9f5ea5f257c43c9381cf3123a1327988fd6d1f Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Thu, 19 Apr 2018 13:59:16 +0200 +Subject: [PATCH] tdf#95843: Wait for fire_glxtest_process also in --headless + mode + +Discussed with mmeeks on IRC that fire_glxtest_process is probably called as +early as possible so that its reuslt is ready by the time it is needed in the +non-headless case. So best fix for headless is probably to just wait for the +sub-process at an opportune point, instead of redesigning the whole mess so that +fire_glxtest_process would only be called once its result is actually needed. + +Cherry-picked from . +Conflicts: + vcl/unx/glxtest.cxx + +Change-Id: I4ea9c9d54b83c9695a3b72317e68fed0c410da0e +--- + desktop/inc/app.hxx | 1 + + desktop/source/app/app.cxx | 9 +++++++++ + desktop/source/app/sofficemain.cxx | 4 ++++ + vcl/inc/opengl/x11/glxtest.hxx | 2 ++ + vcl/unx/glxtest.cxx | 16 ++++++++++++++++ + 5 files changed, 32 insertions(+) + +diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx +index 91dde49439ab..68fc4a396d3c 100644 +--- a/desktop/inc/app.hxx ++++ b/desktop/inc/app.hxx +@@ -187,6 +187,7 @@ OUString ReplaceStringHookProc(const OUString& rStr); + + #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS + bool fire_glxtest_process(); ++void reap_glxtest_process(); + #endif + + #endif // INCLUDED_DESKTOP_INC_APP_HXX +diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx +index 1f9307d0c26f..201f8369125d 100644 +--- a/desktop/source/app/app.cxx ++++ b/desktop/source/app/app.cxx +@@ -1651,6 +1651,15 @@ int Desktop::Main() + CheckOpenCLCompute(xDesktop); + #endif + ++ // In headless mode, reap the process started by fire_glxtest_process() early in soffice_main ++ // (desktop/source/app/sofficemain.cxx), in a code block that needs to be covered by the same ++ // #if condition as this code block: ++#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) && HAVE_FEATURE_OPENGL ++ if (rCmdLineArgs.IsHeadless()) { ++ reap_glxtest_process(); ++ } ++#endif ++ + // Release solar mutex just before we wait for our client to connect + { + SolarMutexReleaser aReleaser; +diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx +index 27b9efa600db..9cbcbc095cf8 100644 +--- a/desktop/source/app/sofficemain.cxx ++++ b/desktop/source/app/sofficemain.cxx +@@ -125,6 +125,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() + #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) && HAVE_FEATURE_OPENGL + /* Run test for OpenGL support in own process to avoid crash with broken + * OpenGL drivers. Start process as early as possible. ++ * In non-headless mode, the process will be reaped in X11OpenGLDeviceInfo::GetData ++ * (vcl/opengl/x11/X11DeviceInfo.cxx). In headless mode, the process will be reaped late in ++ * Desktop::Main (desktop/source/app/app.cxx), in a code block that needs to be covered by the ++ * same #if condition as this code block. + */ + bool bSuccess = fire_glxtest_process(); + SAL_WARN_IF(!bSuccess, "desktop.opengl", "problems with glxtest"); +diff --git a/vcl/inc/opengl/x11/glxtest.hxx b/vcl/inc/opengl/x11/glxtest.hxx +index 979f795de139..d74436aae111 100644 +--- a/vcl/inc/opengl/x11/glxtest.hxx ++++ b/vcl/inc/opengl/x11/glxtest.hxx +@@ -18,6 +18,8 @@ VCL_DLLPUBLIC pid_t* getGlxPid(); + + bool fire_glxtest_process(); + ++void reap_glxtest_process(); ++ + #endif + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/vcl/unx/glxtest.cxx b/vcl/unx/glxtest.cxx +index efe55910d164..87c6044fd772 100644 +--- a/vcl/unx/glxtest.cxx ++++ b/vcl/unx/glxtest.cxx +@@ -26,6 +26,8 @@ + #include "stdint.h" + #include + ++#include ++ + #include "opengl/x11/glxtest.hxx" + + #ifdef __SUNPRO_CC +@@ -35,6 +37,8 @@ + #include "X11/Xlib.h" + #include "X11/Xutil.h" + ++#include ++ + // stuff from glx.h + typedef struct __GLXcontextRec *GLXContext; + typedef XID GLXPixmap; +@@ -273,3 +277,15 @@ bool fire_glxtest_process() + *glxtest_pid = pid; + return true; + } ++ ++void reap_glxtest_process() { ++ pid_t * pid = getGlxPid(); ++ if (*pid != 0) { ++ // Use WNOHANG, as it is probably better to have a (rather harmless) zombie child process ++ // hanging around for the duration of the calling process, than to potentially block the ++ // calling process here: ++ pid_t e = waitpid(*pid, nullptr, WNOHANG); ++ SAL_INFO_IF( ++ e <= 0, "vcl.opengl", "waiting for glxtest process " << *pid << " failed with " << e); ++ } ++} +-- +2.14.3 + diff --git a/libreoffice.spec b/libreoffice.spec index 8220d6b..b7e8c4e 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -57,7 +57,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 4%{?libo_prerelease}%{?dist} +Release: 5%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0 URL: http://www.libreoffice.org/ @@ -256,6 +256,7 @@ Patch11: 0001-tdf-100922-Refactor-Custom-Properties-page.patch Patch12: 0001-sdk-lib-dir-missing-from-Linux-installation-sets.patch Patch13: 0001-rhbz-1392145-ensure-titlebar-close-button-matches-ou.patch Patch14: 0001-Related-rhbz-1396729-use-cairo_surface_create_simila.patch +Patch15: 0001-tdf-95843-Wait-for-fire_glxtest_process-also-in-head.patch %if 0%{?rhel} # not upstreamed @@ -2224,6 +2225,9 @@ done %{_includedir}/LibreOfficeKit %changelog +* Thu Apr 19 2018 Stephan Bergmann - 1:5.4.6.2-5-UNBUILT +- Resolves: rhbz#1568579 LibreOffice --headless zombie process + * Wed Apr 18 2018 Caolán McNamara - 1:5.4.6.2-4 - Related: rhbz#1396729 use cairo_surface_create_similar