Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
php7-gmagick
fix-segfault-on-shutdown.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-segfault-on-shutdown.patch of Package php7-gmagick
There seems to be a problem when the program is terminating if GraphicsMagick has been compiled with OpenMP support and has used more than one thread. It often segfaults with PHP >= 7.4. The solution seems to be to explicitly let OpenMP relinquish its resources before terminating. This is only possible on GCC >= 9, as this function was not available before. On GCC < 9 the alternative is to run in single thread mode. Whether or not GraphicsMagick was compiled with OpenMP support, can be deterimined by adding the output of `GraphicsMagick-config --cflags` to the CFLAGS, which will define _OPENMP in that case. See https://bugs.php.net/bug.php?id=78465 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91256 --- gmagick.c +++ gmagick.c @@ -21,6 +21,10 @@ #include "php_gmagick_macros.h" #include "php_gmagick_helpers.h" +#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ >= 9) +#include <omp.h> +#endif + /* handlers */ static zend_object_handlers gmagick_object_handlers; static zend_object_handlers gmagickdraw_object_handlers; @@ -1709,6 +1713,9 @@ PHP_MINIT_FUNCTION(gmagick) return FAILURE; InitializeMagick(cwd); +#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ < 9) + SetMagickResourceLimit(ThreadsResource, 1); +#endif efree(cwd); /* init constants */ @@ -1722,6 +1729,10 @@ PHP_MINIT_FUNCTION(gmagick) PHP_MSHUTDOWN_FUNCTION(gmagick) { DestroyMagick(); +#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ >= 9) + /* Relinquish resources used by OpenMP on all devices */ + omp_pause_resource_all(omp_pause_hard); +#endif return SUCCESS; } /* }}} */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor