-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault (core dumped) with Imagick (any code, only static frankenphp sapi) #262
Comments
Could you copy the stack trace (using GDB on the core dump)? Thanks! |
Sorry, I'm not familiar with using GDB (all my native projects have been centered around windows with MSVC so far) so it'll take a little while. I've confirmed that it's a problem with Imagick and FrankenPHP though, as using the php binary directly works as expected. [root@localhost frankenphp]# tail -n100 index.php
<?php
error_reporting(E_ALL);
ini_set( 'display_errors','1');
/* Create a new imagick object */
$im = new Imagick();
/* Create new image. This will be used as fill pattern */
$im->newPseudoImage(50, 50, "gradient:red-black");
/* Create imagickdraw object */
$draw = new ImagickDraw();
/* Start a new pattern called "gradient" */
$draw->pushPattern('gradient', 0, 0, 50, 50);
/* Composite the gradient on the pattern */
$draw->composite(Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im);
/* Close the pattern */
$draw->popPattern();
/* Use the pattern called "gradient" as the fill */
$draw->setFillPatternURL('#gradient');
/* Set font size to 52 */
$draw->setFontSize(52);
/* Annotate some text */
$draw->annotation(20, 50, "Hello World!");
/* Create a new canvas object and a white image */
$canvas = new Imagick();
$canvas->newImage(350, 70, "white");
/* Draw the ImagickDraw on to the canvas */
$canvas->drawImage($draw);
/* 1px black border around the image */
$canvas->borderImage('black', 1, 1);
/* Set the format to PNG */
$canvas->setImageFormat('png');
/* Output the image */
header("Content-Type: image/png");
echo $canvas;
?> [root@localhost frankenphp]# /opt/static-php-cli/buildroot/bin/php index.php
�PNG
�
...
���I���IE
... compile frankenphp ...
[root@localhost] ./frankenphp php-cli index.php
Segmentation fault (core dumped) |
Doesn't say a whole lot to me: [root@localhost frankenphp]# gdb ./frankenphp
GNU gdb (GDB) Red Hat Enterprise Linux 10.2-10.el9
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./frankenphp...
(No debugging symbols found in ./frankenphp)
(gdb) run php-cli index.php
Starting program: /opt/frankenphp-main/caddy/frankenphp/frankenphp php-cli index.php
[New LWP 1998726]
[New LWP 1998727]
[New LWP 1998728]
[New LWP 1998729]
[New LWP 1998730]
[New LWP 1998731]
[New LWP 1998732]
[New LWP 1998733]
Thread 9 "frankenphp" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1998733]
0x00007ffff31072c3 in ?? ()
(gdb) How do I compile frankenphp with debug symbols? |
The easiest way is to follow these instructions: https://github.com/dunglas/frankenphp/blob/main/CONTRIBUTING.md |
[root@alma frankenphp]# gdb -q frankenphp
Reading symbols from frankenphp...
(gdb) run php-cli index.php
Starting program: /opt/frankenphp/caddy/frankenphp/frankenphp php-cli index.php
[New LWP 1339544]
[New LWP 1339545]
[New LWP 1339546]
[New LWP 1339547]
[New LWP 1339548]
[New LWP 1339549]
[New LWP 1339550]
[New LWP 1339551]
[New LWP 1339552]
[New LWP 1339553]
[New LWP 1339554]
[New LWP 1339555]
Thread 13 "frankenphp" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1339555]
OpenPixelCache (image=image@entry=0x7fffb065b020, mode=mode@entry=IOMode, exception=exception@entry=0x7fffb0808140)
at MagickCore/cache.c:3677
3677 if (IsEventLogging() != MagickFalse)
(gdb) info frame
Stack level 0, frame at 0x7fffb0e31360:
rip = 0x25d55a3 in OpenPixelCache (MagickCore/cache.c:3677); saved rip = 0x437b4d
called by frame at 0x7fffb0e34850
source language c.
Arglist at 0x7fffb0e2cd48, args: image=image@entry=0x7fffb065b020, mode=mode@entry=IOMode,
exception=exception@entry=0x7fffb0808140
Locals at 0x7fffb0e2cd48, Previous frame's sp is 0x7fffb0e31360
Saved registers:
rbx at 0x7fffb0e31328, rbp at 0x7fffb0e31330, r12 at 0x7fffb0e31338, r13 at 0x7fffb0e31340, r14 at 0x7fffb0e31348,
r15 at 0x7fffb0e31350, rip at 0x7fffb0e31358
(gdb) info args
image = 0x7fffb065b020
mode = IOMode
exception = 0x7fffb0808140
(gdb) info locals
cache_info = <optimized out>
source_info = {storage_class = UndefinedClass, colorspace = UndefinedColorspace, alpha_trait = UndefinedPixelTrait,
channels = UndefinedChannel, columns = 0, rows = 0, metacontent_extent = 0, number_channels = 0, channel_map = {{
channel = UndefinedPixelChannel, traits = UndefinedPixelTrait, offset = 0} <repeats 64 times>},
type = UndefinedCache, mode = ReadMode, disk_mode = ReadMode, mapped = MagickFalse, offset = 0, length = 0,
virtual_pixel_method = UndefinedVirtualPixelMethod, virtual_pixel_color = {storage_class = UndefinedClass,
colorspace = UndefinedColorspace, alpha_trait = UndefinedPixelTrait, fuzz = 0, depth = 0, count = 0, red = 0,
green = 0, blue = 0, black = 0, alpha = 0, index = 0}, number_threads = 0, nexus_info = 0x0, pixels = 0x0,
metacontent = 0x0, file = 0, filename = '\000' <repeats 4095 times>, cache_filename = '\000' <repeats 4095 times>,
methods = {get_virtual_pixel_handler = 0x0, get_virtual_pixels_handler = 0x0,
get_virtual_metacontent_from_handler = 0x0, get_one_virtual_pixel_from_handler = 0x0,
get_authentic_pixels_handler = 0x0, get_authentic_metacontent_from_handler = 0x0,
get_one_authentic_pixel_from_handler = 0x0, get_authentic_pixels_from_handler = 0x0,
queue_authentic_pixels_handler = 0x0, sync_authentic_pixels_handler = 0x0, destroy_pixel_handler = 0x0},
random_info = 0x0, server_info = 0x0, synchronize = MagickFalse, debug = MagickFalse, id = 0x0, reference_count = 0,
semaphore = 0x0, file_semaphore = 0x0, timestamp = 0, signature = 0, opencl = 0x0, composite_mask = MagickFalse,
width_limit = 0, height_limit = 0}
format = '\000' <repeats 4095 times>
message = '\000' <repeats 4095 times>
hosts = <optimized out>
type = <optimized out>
status = <optimized out>
length = <optimized out>
number_pixels = <optimized out>
columns = <optimized out>
packet_size = <optimized out>
__func__ = "OpenPixelCache"
(gdb) bt
#0 OpenPixelCache (image=image@entry=0x7fffb065b020, mode=mode@entry=IOMode, exception=exception@entry=0x7fffb0808140)
at MagickCore/cache.c:3677
#1 0x0000000000437b4d in GetImagePixelCache (image=0x7fffb065b020, clone=clone@entry=MagickTrue,
exception=exception@entry=0x7fffb0808140) at MagickCore/cache.c:1771
#2 0x00000000025d871b in SyncImagePixelCache (image=<optimized out>, exception=exception@entry=0x7fffb0808140)
at MagickCore/cache.c:5587
#3 0x0000000002663dc8 in SetImageExtent (image=<optimized out>, columns=<optimized out>, rows=<optimized out>,
exception=exception@entry=0x7fffb0808140) at MagickCore/image.c:2669
#4 0x000000000278fae2 in ReadMIFFImage (image_info=<optimized out>, exception=<optimized out>) at coders/miff.c:1328
#5 0x00000000025f8045 in ReadImage (image_info=image_info@entry=0x7fffb065f020,
exception=exception@entry=0x7fffb0808140) at MagickCore/constitute.c:736
#6 0x00000000025c9dc3 in BlobToImage (image_info=image_info@entry=0x7fffb0632650, blob=blob@entry=0x7fffb06831d0,
length=15494, exception=exception@entry=0x7fffb0808140) at MagickCore/blob.c:477
#7 0x00000000025f96a2 in ReadInlineImage (image_info=image_info@entry=0x7fffb062f360,
content=content@entry=0x7fffb0624d10 "data:image/x-gradient;base64,\n aWQ9SW1hZ2VNYWdpY2sgdmVyc2lvbj0xLjAKY2xhc3M9RGlyZWN0Q2xhc3MgY29sb3JzPTAgYWxw\n aGEtdHJhaXQ9VW5kZWZpbmVkCm51bWJlci1jaGFubmVscz0zIG51bWJlci1tZXRhLWNoYW5uZWxz\n PTAgY2hhbm5lb"..., exception=exception@entry=0x7fffb0808140) at MagickCore/constitute.c:1177
#8 0x000000000261a3ad in DrawPrimitive (image=image@entry=0x7fffb068f3f0, draw_info=0x7fffb0687490,
primitive_info=primitive_info@entry=0x7fffafc74550, exception=exception@entry=0x7fffb0808140)
at MagickCore/draw.c:5612
#9 0x0000000002620258 in RenderMVGContent (image=0x7fffb068f3f0, draw_info=draw_info@entry=0x7fffb0687010,
depth=depth@entry=0, exception=exception@entry=0x7fffb0808140) at MagickCore/draw.c:4488
#10 0x0000000002626352 in DrawPatternPath (image=0x7fffb076e2d0, draw_info=0x7fffb07abb10,
name=0x7fffb070f260 "gradient", pattern=0x7fffb07aaf50, exception=0x7fffb0808140) at MagickCore/draw.c:4619
#11 0x0000000002622da7 in RenderMVGContent (image=0x7fffb076e2d0, draw_info=draw_info@entry=0x7fffb07abb10,
depth=depth@entry=0, exception=<optimized out>) at MagickCore/draw.c:3673
#12 0x000000000262680a in DrawImage (image=<optimized out>, draw_info=draw_info@entry=0x7fffb07abb10,
exception=<optimized out>) at MagickCore/draw.c:4527
#13 0x00000000025a33f3 in MagickDrawImage (wand=0x7fffb07b0110, drawing_wand=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
at MagickWand/magick-image.c:3102
#14 0x0000000001bc607d in zim_Imagick_drawImage (execute_data=<optimized out>, return_value=0x7fffb0e4c4b0)
at /opt/static-php-cli/source/php-src/ext/imagick/imagick_class.c:10393
#15 0x0000000001815705 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:1842
#16 execute_ex (ex=<optimized out>) at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:56077
#17 0x000000000181da73 in zend_execute (op_array=0x7fffb0c7b000, return_value=0x0)
at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:60409
#18 0x00000000017c783d in zend_execute_scripts (type=type@entry=8, retval=0x7fffb0c87700, retval@entry=0x0,
file_count=file_count@entry=3) at /opt/static-php-cli/source/php-src/Zend/zend.c:1833
#19 0x000000000178d684 in php_execute_script (primary_file=0x7fffb0e4e8f0)
at /opt/static-php-cli/source/php-src/main/main.c:2557
#20 0x00000000017863fc in execute_script_cli ()
#21 0x0000000002b3afea in start ()
#22 0x00007fffb0e4ea78 in ?? ()
#23 0x0000000000000000 in ?? ()
(gdb) Apparently the crash happens here: https://github.com/ImageMagick/ImageMagick/blob/main/MagickCore/cache.c#L3677 But I'm kind of at a loss on how to proceed. Maybe I could upload the binary & php-embed used to compile it? |
A slightly different stacktrace after recompiling with a different version of gcc. [root@localhost frankenphp]# /opt/static-php-cli/buildroot/bin/php index.php
�PNG
�
IHDR�`���/� cHRMz&�����u0�`:��p��Q<�bKGD��������3IDATx��yPTW�ǿ͢����.�"� �%@Dd�0F'�I
e2eB&q�I��+���bbb&c2ѱj̸�L�%��J�����
����*H���Ⱦ�4���n�o��Gw?������>��{ϻ���s7 ���`pL@� >�@ �
�D"�� ���� ��A$��&�� �@ �D�8`��@� � ��A$��&�� �@ �D�8`��@� � ��A$��&��0��.ٰ�W$�J꯬ԙ��3g����8`�����(e�1w�N����V1�Uib�`}#���jb��Y��`�]ׯ3�]�H�w����0b����^��[�j���do�M���#��i>�c�,0LK�d�E�������Ft,?����a<���L���320$�3t6���q�:C�����~~b�oզ��;���uL
��NW�����0��d�^Nc��O����2��p}=�e2�͟�[_Sj*��z����V9`��<�{��r�ט��O��CB���d�����黯t��4�ߏ�k���lV:`�4'&Fl���������3mC���������HLL`���
p��UU訬du�����!�jj�����e7Mz�b�)����ݞN��<DK�����O���z��kL|�
v11���(��7��2�����y�l�~���������b�M'�զ�|���7U0H
����t��,�'sX��A8��S�G�8psQ����`je�YO]Z�E����
��_�-%%諫���;g��,�_�i�~�kSB��
��6 |NMן_6AA0����kht�M7np֡��Q������II
{���7��������M�C�|�H
3�ͣ\����������F���I���z1`��H������,��x8`�m���� x����0;L��0H�����ͨ�=�a���\�vvR��۶
���b�KgL�Y���W� l�,�kB�����S��ڸ��˘S<��
�uu�kl���̝�`�����P,\��scb`<s��\���xfu99P����?;�J9��[��j^B�n}������4���52r\����8u�x��Ĵ�bt�%�O��矣��m���#d�nD��7&��6���
�wߡ29��UU�w
�����`5><�|���y�fc����T����{�TA�A8]¶��oxtx�7��A������d|�_]���j =�yǎ�r�^�lۆ�-[0�����\C�\��4����;Q����y�L�V�
wss�{�(,�����w������~��������}�Ϳ֯�M��pZ�L뽃�����C����z���� 71��ȯ�j�ŋ��p-��[�r�(R_}u���W_Ū#G�uu�f�Z4��P�i�ϧ�=�65�ׇ�w�A�C�3��s�w�@��������w/���#SS��i������iP�Rv�F-��)���!��7p<$��UU�ʩ��D����Ӡ H��9�g�@Gc#�_~��-_���6�>!�$����!�C�dd`P-T0"�`A|<`����""(:�\��
���ʁ�8�������� ���[�_��ЄĀ[�����q��m�/�zj�J�iD������A��*.�ۇ
�vQ���T}�:NDG���}�>%&�X�p5\N��������i�sZ�X�����V�:[��AW[>�y�`�pᤱ5�L����|��ߠIÂ��8:�����r���Fsu5������֯������s�D�x��������'�@[]�������7#`�F8�����}mmh((@�W_���_P�;���8�.+���
�rr��s���o�E�����f�}�%��_;OO�������UW� ��I���R�닋��
/ i��ڌ��|�J��X@�Y������[o��r�Ҵ4,ղ�L��Ug�8�Cۚ���R�|����
�O=��{������ $) ����vw�`O���P��(�����ʬ,T��R�I�=`��M� YK��������S��q�
�q��=�s'���v��x��Ix�~zZ�������O<�����&%���a��.|����Ds������G����g��'�-|�����g�T�%����/�|}���+�<r�ɻvaTm�@�ŋ�=y�aII�� ��}|`��N�������2�l4l��ZU����L���_��˖a���z��˥�/ju�U��
�yhq�bؚ�ΥW����h�3����]��x��X:;���ۦR��GmI �z�[oa��}0V��`�����!r�|�����jeFԜ� ��D����䠝���HCi)����B\;~�r���
���3--��뛐�=��8�t)�y�8s����
<W�`���m�e������?F[S��wL
^<w&ZF�%� ��m���9�|�e�g?�ۇ�͛a�af��<bc��/���,�kp��ޯ�Y�X��Q��ի�w��ص�q�dHY���j���akz{�����?z�6l8F&�_i>m�����1d��!b��њϼ�0lIO�G���nld|N��� ��>��sz�s���#G(e�H$H<~|\������?�i������rt��
Aȇ�q�� ��L
<���Z��:���������cך��P�\����x�� �急Y�U��怽��`jfƐ�MH�u5��Ѐ��B���2d���QWZJ ��{x�V×�X�f
��@Hb"~��'���Ӧ�O�B���ڒ'������[��O�=�O�~������DB-�D��Ω�h�p�N�z�����:s�"������h^�
~�Yx����/]�`Og;�&�~��������۶������AF���}�K�|�q`�tG�@ܨ\��K�(�>�NVX�z5��/�*�i��V�!��"�%� ��Yۃ������'�6u��)�
�##l���U<��anx���34anoO�O}n�t@�ih�N�z��ׯ����"��q����o�L��?4��m�
}��Q��ɐ�ؼ�w}\�/�{h(EOYv� �p�~��X/X@��PT���.�lUn.��ˏ58`KGG�>E6_C�B�2��G�����l�!81�������ڦzZ[!��
Z�z5�h�z\�x�E^�:V..��fk�䞊��<dभ\��E�������������.˨4�����U�NNE���� �S�u�]���V�..�ж������ec�����f����t�F�� ����L
��2�J��p��WK�W,[�m����l5�\۔F^�,��.�o���ŵl��B��r�9`�b�������oS6��9�O��rM�7���M�4������Q�9�Ό��i�ө�A���B������+{������NO8.��EکS�k�Y��n����]�����``B��y�_�74��
��];vmT.GiNE����l���IJ5[
�#$�W~\۔�����N�������Ѫ6�����Q���t���1�"k�����P���xR���v��O���5�<���\�N��iG����wY���W�8
�&��2��N -��ى۴���4M�'"��VV�S
g䥤P���ݴ��b-�1m���m��x�ǵMu*����H$p����.���/�������4s��v)���p;mœ�So_��r�j)rOG�
fs��Ŝ9
}����|J��ss���u03'�2O6��%�j����ǚ061�\��\�@�m�����������Q���47���6�A{GL��'4����V� �Ɍ���v����3������֫���b_v��A������)��S�3�C3�X6(�%���$�==�T�X&Oy��*���ÎC�/���)�ݭ��=���E,hq�bښ>���N|�ܦhK�Mf��\G����B��q_�}6���?�+�L--1���]�������Yy�4
�]��U�l�lF��5�¹0�����6����A��B��q��^���[��
h+��-Z�;WW��Ĵ5��
S+��G�'���s\]!U�Ƴ%�?�m/�Yʟ}*���O�~�w;�k�n6�>�9��A��g�:�66z�M�ʕ�<���k��^U�jhˏ�lj��p�?��������]�NI���[���m)z�8�?�ik��g":�i�l��Ĩ\.8
�I�'�l���϶�Ƭ �ژ�<���Y��Qd[[Z
a��-�026�
�O���Tp9k+*���ֳ��qtļ%K(y�Tn�s����f�@��Նl����9�����B!K�!h��'Ŵ�.N��ڦ���(2C
��KK�׳��\P
��i ��u n�
k"���~�����٢�7���D9MO=y����>�������h�ɐEs�~��0���7��=egO�p�en���Ų�.�0�6�M[�2
M[8@�a����Z���a �9������s�(���o��Y6E���~�>�\���+��!�J1_�yf��.P��� �0'GP�{��Q��<���i<
ɬY�R����ŋ���������h���!��'zB
/��;�+?���Qj��� ��d l��2d��=`�J�}� �u%\Pd$������x�qW���=8��c)��yV��VN.1`��A˗3l���Ӽ�S#��Ff&EO�c�i]�+B��1bdD���?����Nʵp���f��!h�
����d��ˣ���x��X���~&�����>˖Qd/������/�|u���p����8��l�4ՙ�m߰�X�n�E���_�Rm��
�n�@����=�ZfS�3��r��F���'���e#mm���
x�E^:�bmc�� J���nQ�vv����86�����������\
�'�D������lݴ��i���ف����x���(��==ؾy3�5�K�����p��E���;��[���7a,����G��`$���(�@��!H$x��nxb�ڐ�p��M063������8v�������b�+��ۛcy��űcc��ٳ�j=yy({�����p�*�;���MD�Jh'�ҩ���Ƅ�T���Z�q#�xyq.���|y�NXҶﻔ����z
mZfz(�
���a�dyYv��6LL
2T�dٞR=E�������ܹ��z.Y�;�1F1lm�����5����0���=��o�������㩸8ܭ����>��7���?�����e�NC,�Hp��)̢M)�]V���0$%&"���ܭ��;�lA���(PnȢJV8p�0o;�R������=ʸ��
���x1���ȿy�������@ue%�{����������������n�6��8"M�GEa��D������U'���PO���b���=`xm�^xѦ�8��;�
������n�����2�2���jR�b��pG*�����䀅��<�P�gׯW���TYQ�3�_}��C����ޟSS������$�ٳ��W���ס�)�y���T^���|sB�1��˖)Z��u����2<��LA��MH�wg� g�j���o���Ӑ������hw|�Ҧ*�������������(/�\[��o��A�/<(hBm`2�@��ƀUĮZ��4X��gpM�nn�.%��EE�����B���~�=����!72�T�山�)#�v��:~R�X�!<��/���C�һ��H���i(b�Z�=`.m���/Í�q>������ϟ���9�����ƀՉ���m��[�og}Aْ���^�������c�˩Kyuv��:ro�B�81U�����O#%=�V��G������;Almm�`��q��.�-�S%IJ�>b�\uxy{#�������LMǭ��[�o���l8��0��?@���1yhn�~��A�J�����v��
���?�?A#���8`��@���Db����@ ���L "A�0�@ ��q���� �����H�L "A�0�@ ��q���� �����H�L "A�0�@ ��q���� �����H�L "A�0�@ ��q���� �����H�L "!�n��$��G�����I���IECGO_CFLAGS="$(/opt/static-php-cli/buildroot/bin/php-config --includes | sed s#-I/#-I/opt/static-php-cli/buildroot/#g)" CGO_LDFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(/opt/static-php-cli/buildroot/bin/php-config --ldflags) -Wl,--start-group $(/opt/static-php-cli/buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g') -Wl,--end-group" LIBPHP_VERSION="$(/opt/static-php-cli/buildroot/bin/php-config --version)" go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -w -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $LIBPHP_VERSION Caddy'" && ./frankenphp version
FrankenPHP PHP Caddy v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=
[root@localhost frankenphp]# ./frankenphp php-cli index.php
Segmentation fault (core dumped)
[root@localhost frankenphp]# gdb -q frankenphp
Reading symbols from frankenphp...
(gdb) run php-cli index.php
Starting program: /opt/frankenphp-main/caddy/frankenphp/frankenphp php-cli index.php
[New LWP 2465459]
[New LWP 2465460]
[New LWP 2465461]
[New LWP 2465462]
[New LWP 2465463]
[New LWP 2465464]
[New LWP 2465465]
[New LWP 2465466]
Thread 9 "frankenphp" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 2465466]
OpenPixelCache (image=image@entry=0x7fffa9232340, mode=mode@entry=IOMode, exception=exception@entry=0x7fffa951d180)
at MagickCore/cache.c:3680
3680 if (IsEventLogging() != MagickFalse)
(gdb) bt
#0 OpenPixelCache (image=image@entry=0x7fffa9232340, mode=mode@entry=IOMode, exception=exception@entry=0x7fffa951d180)
at MagickCore/cache.c:3680
#1 0x00007ffff12b38ab in GetImagePixelCache (image=0x7fffa9232340, clone=clone@entry=MagickTrue,
exception=exception@entry=0x7fffa951d180) at MagickCore/cache.c:1784
#2 0x00007ffff338117b in SyncImagePixelCache (image=<optimized out>, exception=exception@entry=0x7fffa951d180)
at MagickCore/cache.c:5613
#3 0x00007ffff340d058 in SetImageExtent (image=<optimized out>, columns=<optimized out>, rows=<optimized out>,
exception=exception@entry=0x7fffa951d180) at MagickCore/image.c:2669
#4 0x00007ffff3536d49 in ReadMIFFImage (image_info=<optimized out>, exception=<optimized out>) at coders/miff.c:1328
#5 0x00007ffff33a088a in ReadImage (image_info=image_info@entry=0x7fffa9239360,
exception=exception@entry=0x7fffa951d180) at MagickCore/constitute.c:736
#6 0x00007ffff337207e in BlobToImage (image_info=image_info@entry=0x7fffa9236040, blob=blob@entry=0x7fffa953b020,
length=15494, exception=exception@entry=0x7fffa951d180) at MagickCore/blob.c:477
#7 0x00007ffff33a1f32 in ReadInlineImage (image_info=image_info@entry=0x7fffa9557660,
content=content@entry=0x7fffa9205e80 "data:image/x-gradient;base64,\n aWQ9SW1hZ2VNYWdpY2sgdmVyc2lvbj0xLjAKY2xhc3M9RGlyZWN0Q2xhc3MgY29sb3JzPTAgYWxw\n aGEtdHJhaXQ9VW5kZWZpbmVkCm51bWJlci1jaGFubmVscz0zIG51bWJlci1tZXRhLWNoYW5uZWxz\n PTAgY2hhbm5lb"..., exception=exception@entry=0x7fffa951d180) at MagickCore/constitute.c:1177
#8 0x00007ffff33c3573 in DrawPrimitive (image=image@entry=0x7fffa955b200, draw_info=draw_info@entry=0x7fffa95c1490,
primitive_info=0x7fffa8855380, exception=exception@entry=0x7fffa951d180) at MagickCore/draw.c:5612
#9 0x00007ffff33c951d in RenderMVGContent (image=0x7fffa955b200, draw_info=draw_info@entry=0x7fffa95c1010,
depth=depth@entry=0, exception=exception@entry=0x7fffa951d180) at MagickCore/draw.c:4488
#10 0x00007ffff33cf5eb in DrawPatternPath (image=image@entry=0x7fffa95ea110, draw_info=draw_info@entry=0x7fffa969bb10,
name=name@entry=0x7fffa955f080 "gradient", pattern=pattern@entry=0x7fffa969af50,
exception=exception@entry=0x7fffa951d180) at MagickCore/draw.c:4619
#11 0x00007ffff33cce33 in RenderMVGContent (image=0x7fffa95ea110, draw_info=draw_info@entry=0x7fffa969bb10,
depth=depth@entry=0, exception=<optimized out>) at MagickCore/draw.c:2960
#12 0x00007ffff33cfada in DrawImage (image=<optimized out>, draw_info=draw_info@entry=0x7fffa969bb10,
exception=<optimized out>) at MagickCore/draw.c:4527
#13 0x00007ffff3349e6a in MagickDrawImage (wand=0x7fffa95ef270, drawing_wand=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
at MagickWand/magick-image.c:3102
#14 0x00007ffff2a7612a in zim_Imagick_drawImage (execute_data=<optimized out>, return_value=0x7fffa9ddc360)
at /opt/static-php-cli/source/php-src/ext/imagick/imagick_class.c:10393
#15 0x00007ffff269d8e2 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:1842
#16 execute_ex (ex=<optimized out>) at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:56077
#17 0x00007ffff26a6641 in zend_execute (op_array=0x7fffa9a7b000, return_value=0x0)
at /opt/static-php-cli/source/php-src/Zend/zend_vm_execute.h:60409
#18 0x00007ffff264b616 in zend_execute_scripts (type=type@entry=8, retval=0x7fffa9a87700, retval@entry=0x0,
file_count=file_count@entry=3) at /opt/static-php-cli/source/php-src/Zend/zend.c:1833
#19 0x00007ffff260c278 in php_execute_script (primary_file=0x7fffa9dde7b0)
at /opt/static-php-cli/source/php-src/main/main.c:2557
#20 0x00007ffff2603a5c in execute_script_cli ()
#21 0x00007ffff38f838b in start ()
#22 0x00007fffa9ddeb38 in ?? ()
#23 0x0000000000000000 in ?? ()
(gdb)``` |
Thanks! This looks like a bug in ImageMagick or in the ImageMagick extension with ZTS builds. Could you report this upstream please? (https://github.com/Imagick/imagick) |
NTS/ZTS didn't seem to make a difference, got the same stack trace for both. It must somehow be limited to the embed SAPI though, as the CLI binary runs it without a problem. Will report to the imagick repo. |
NTS isn't supported by FrankenPHP and we don't use the embed SAPI, except for the |
I've used static-php-cli to build php-embed (which I believe FrankenPHP uses for the static build) and php-cli. Using the generated cli binary, Imagick works fine. Using FrankenPHP, both with |
Full log from console: alpine:/opt/static-php-cli# ./bin/spc build imagick --with-libs=libpng,libjpeg,libwebp,freetype --enable-zts --build-embed --build-cli
_ _ _ _
___| |_ __ _| |_(_) ___ _ __ | |__ _ __
/ __| __/ _` | __| |/ __|____| '_ \| '_ \| '_ \
\__ \ || (_| | |_| | (_|_____| |_) | | | | |_) |
|___/\__\__,_|\__|_|\___| | .__/|_| |_| .__/ v2.0.0
|_| |_|
[15:48:26] [INFO] [EXEC] echo | gcc -E -x c - -march=corei7 2>/dev/null
[15:48:26] [INFO] [EXEC] echo | gcc -E -x c - -mtune=core-avx2 2>/dev/null
[15:48:26] [INFO] Build target: cli, embed
[15:48:26] [INFO] Enabled extensions: imagick
[15:48:26] [INFO] Required libraries: zlib, libpng, libjpeg, libwebp, freetype, imagemagick
[15:48:28] [INFO] extracting pkg-config source
[15:48:28] [INFO] extracting zlib source
[15:48:28] [INFO] extracting libpng source
[15:48:28] [INFO] extracting libjpeg source
[15:48:28] [INFO] extracting libwebp source
[15:48:28] [INFO] extracting freetype source
[15:48:28] [INFO] extracting imagemagick source
[15:48:29] [INFO] Building required library [pkg-config]
[15:48:29] [INFO] Entering dir: /opt/static-php-cli/source/pkg-config
[15:48:29] [INFO] [EXEC] PKG_CONFIG_PATH="/opt/static-php-cli/buildroot/lib/pkgconfig" CC='gcc' CXX='g++' ./configure --disable-shared --enable-static --with-internal-glib --prefix=/opt/static-php-cli/buildroot --without-sysroot --without-system-include-path --without-system-library-path --without-pc-path
[15:48:37] [INFO] [EXEC] make clean
[15:48:38] [INFO] [EXEC] make -j16
[15:48:41] [INFO] [EXEC] make install
[15:48:41] [INFO] lib [pkg-config] build success
[15:48:41] [INFO] Building required library [zlib]
[15:48:41] [INFO] Entering dir: /opt/static-php-cli/source/zlib
[15:48:41] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' ./configure --static --prefix=
[15:48:42] [INFO] [EXEC] make clean
[15:48:42] [INFO] [EXEC] make -j16
[15:48:42] [INFO] [EXEC] make install DESTDIR=/opt/static-php-cli/buildroot
[15:48:42] [INFO] Patching library [zlib] pkgconfig
[15:48:42] [INFO] lib [zlib] build success
[15:48:42] [INFO] Building required library [libpng]
[15:48:42] [INFO] Entering dir: /opt/static-php-cli/source/libpng
[15:48:42] [INFO] [EXEC] chmod +x ./configure
[15:48:42] [INFO] [EXEC] chmod +x ./install-sh
[15:48:42] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' ./configure --host=x86_64-unknown-linux --disable-shared --enable-static --enable-hardware-optimizations --with-zlib-prefix="/opt/static-php-cli/buildroot" --enable-intel-sse --prefix=
[15:48:45] [INFO] [EXEC] make clean
[15:48:45] [INFO] [EXEC] make -j16 DEFAULT_INCLUDES='-I. -I/opt/static-php-cli/buildroot/include' LIBS= libpng16.la
[15:48:46] [INFO] [EXEC] make install-libLTLIBRARIES install-data-am DESTDIR=/opt/static-php-cli/buildroot
[15:48:46] [INFO] Entering dir: /opt/static-php-cli/buildroot/lib
[15:48:46] [INFO] [EXEC] ln -sf libpng16.a libpng.a
[15:48:46] [INFO] Patching library [libpng] pkgconfig
[15:48:46] [INFO] lib [libpng] build success
[15:48:46] [INFO] Building required library [libjpeg]
[15:48:46] [INFO] Entering dir: /opt/static-php-cli/source/libjpeg/build
[15:48:46] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/ -DCMAKE_INSTALL_LIBDIR=/lib -DCMAKE_INSTALL_INCLUDEDIR=/include -DCMAKE_TOOLCHAIN_FILE=/opt/static-php-cli/source/toolchain.cmake -DENABLE_STATIC=ON -DENABLE_SHARED=OFF ..
[15:48:47] [INFO] [EXEC] cmake --build . -j 16
[15:48:54] [INFO] [EXEC] make install DESTDIR=/opt/static-php-cli/buildroot
[15:48:54] [INFO] Patching library [libjpeg] pkgconfig
[15:48:54] [INFO] lib [libjpeg] build success
[15:48:54] [INFO] Building required library [libwebp]
[15:48:54] [INFO] Entering dir: /opt/static-php-cli/source/libwebp/build
[15:48:54] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/ -DCMAKE_INSTALL_LIBDIR=/lib -DCMAKE_INSTALL_INCLUDEDIR=/include -DCMAKE_TOOLCHAIN_FILE=/opt/static-php-cli/source/toolchain.cmake -DBUILD_SHARED_LIBS=OFF -DWEBP_BUILD_EXTRAS=ON ..
[15:48:55] [INFO] [EXEC] cmake --build . -j 16
[15:48:59] [INFO] [EXEC] make install DESTDIR=/opt/static-php-cli/buildroot
[15:49:00] [INFO] Patching library [libwebp] pkgconfig
[15:49:00] [INFO] Patching library [libwebp] pkgconfig
[15:49:00] [INFO] lib [libwebp] build success
[15:49:00] [INFO] Building required library [freetype]
[15:49:00] [INFO] Entering dir: /opt/static-php-cli/source/freetype
[15:49:00] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' ./configure --enable-static --disable-shared --without-harfbuzz --prefix= --with-png --without-bzip2 --without-brotli
[15:49:01] [INFO] [EXEC] make clean
[15:49:01] [INFO] [EXEC] make -j16
[15:49:06] [INFO] [EXEC] make install DESTDIR=/opt/static-php-cli/buildroot
[15:49:06] [INFO] Patching library [freetype] pkgconfig
[15:49:06] [INFO] lib [freetype] build success
[15:49:06] [INFO] Building required library [imagemagick]
[15:49:06] [INFO] Entering dir: /opt/static-php-cli/source/imagemagick
[15:49:06] [INFO] [EXEC] PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin' ./configure --enable-static --disable-shared --without-jxl --without-xml --without-x --disable-openmp --without-zip --with-jpeg --with-png --with-webp --without-zstd --with-freetype --prefix=
[15:49:16] [INFO] [EXEC] make clean
[15:49:16] [INFO] [EXEC] make -j16
[15:49:39] [INFO] [EXEC] make install DESTDIR=/opt/static-php-cli/buildroot
[15:49:39] [INFO] Patching library [imagemagick] pkgconfig
[15:49:39] [INFO] lib [imagemagick] build success
[15:49:39] [INFO] extracting php-src source
[15:49:41] [INFO] extracting micro source
patching file build/order_by_dep.awk
patching file ext/opcache/ZendAccelerator.c
Hunk #1 succeeded at 93 (offset 2 lines).
Hunk #2 succeeded at 4783 (offset -28 lines).
patching file ext/opcache/config.m4
patching file ext/opcache/config.w32
patching file main/main.c
Hunk #1 succeeded at 2012 with fuzz 2 (offset 1 line).
Hunk #2 succeeded at 2269 (offset 4 lines).
patching file win32/build/confutils.js
Hunk #1 succeeded at 1534 (offset -1 lines).
patching file ext/fileinfo/config.w32
patching file ext/openssl/config.w32
patching file TSRM/tsrm_win32.c
Hunk #1 succeeded at 530 (offset -1 lines).
patching file ext/ffi/ffi.c
Hunk #1 succeeded at 5293 (offset 46 lines).
patching file ext/opcache/ZendAccelerator.c
Hunk #1 succeeded at 2845 (offset 15 lines).
Hunk #2 succeeded at 3150 (offset 22 lines).
Hunk #3 succeeded at 3162 with fuzz 2 (offset 22 lines).
patching file ext/pcre/php_pcre.c
Hunk #1 succeeded at 300 (offset 9 lines).
patching file ext/readline/readline_cli.c
patching file ext/sqlite3/sqlite3.c
patching file ext/standard/php_fopen_wrapper.c
patching file ext/standard/proc_open.c
patching file main/main.c
Hunk #2 succeeded at 1354 (offset 14 lines).
patching file win32/console.c
patching file configure.ac
Hunk #1 succeeded at 1114 (offset 109 lines).
patching file win32/winutil.c
patching file win32/build/confutils.js
Hunk #1 succeeded at 3452 (offset -2 lines).
Hunk #2 succeeded at 3464 (offset -2 lines).
patching file Zend/zend_stream.c
[15:49:41] [INFO] Patched source [micro] after extracted
[15:49:41] [INFO] extracting ext-imagick source
[15:49:41] [INFO] Extension [imagick] patched before buildconf
[15:49:41] [INFO] Entering dir: /opt/static-php-cli/source/php-src
[15:49:41] [INFO] [EXEC] ./buildconf --force
[15:49:45] [INFO] Entering dir: /opt/static-php-cli/source/php-src
[15:49:45] [INFO] Using configure: --with-imagick=/opt/static-php-cli/buildroot
[15:49:45] [INFO] [EXEC] ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg --enable-cli --disable-fpm --enable-embed=static --disable-micro --enable-zts --disable-zend-signals --enable-zend-max-execution-timers --with-imagick=/opt/static-php-cli/buildroot PKG_CONFIG='/opt/static-php-cli/buildroot/bin/pkg-config' PKG_CONFIG_PATH='/opt/static-php-cli/buildroot/lib/pkgconfig' CC='gcc' CXX='g++' CFLAGS='' LIBS='-ldl -lpthread' PATH='/opt/static-php-cli/buildroot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin'
[15:49:52] [INFO] Extension [imagick] patched before make
[15:49:52] [INFO] cleaning up
[15:49:52] [INFO] Entering dir: /opt/static-php-cli/source/php-src
[15:49:52] [INFO] [EXEC] make clean
[15:49:52] [INFO] building cli
[15:49:52] [INFO] Entering dir: /opt/static-php-cli/source/php-src
[15:49:52] [INFO] [EXEC] sed -i "s|//lib|/lib|g" Makefile
[15:49:52] [INFO] [EXEC] make -j16 EXTRA_CFLAGS='-g -Os -fno-ident -Xcompiler -march=corei7 -Xcompiler -mtune=core-avx2' EXTRA_LIBS='/opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libfreetype.a /opt/static-php-cli/buildroot/lib/libwebp.a /opt/static-php-cli/buildroot/lib/libwebpdecoder.a /opt/static-php-cli/buildroot/lib/libwebpdemux.a /opt/static-php-cli/buildroot/lib/libwebpmux.a /opt/static-php-cli/buildroot/lib/libsharpyuv.a /opt/static-php-cli/buildroot/lib/libjpeg.a /opt/static-php-cli/buildroot/lib/libturbojpeg.a /opt/static-php-cli/buildroot/lib/libpng16.a /opt/static-php-cli/buildroot/lib/libz.a /opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libjpeg.a /opt/static-php-cli/buildroot/lib/libpng.a /opt/static-php-cli/buildroot/lib/libwebp.a /opt/static-php-cli/buildroot/lib/libfreetype.a /opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a -lgomp ' EXTRA_LDFLAGS_PROGRAM=' -all-static' cli
[15:50:24] [INFO] Entering dir: /opt/static-php-cli/source/php-src/sapi/cli
[15:50:24] [INFO] [EXEC] strip --strip-all php
[15:50:24] [INFO] Deploying cli file
[15:50:24] [INFO] [EXEC] cp '/opt/static-php-cli/source/php-src/sapi/cli/php' '/opt/static-php-cli/buildroot/bin/'
[15:50:24] [INFO] building embed
[15:50:24] [INFO] Entering dir: /opt/static-php-cli/source/php-src
[15:50:24] [INFO] [EXEC] sed -i "s|//lib|/lib|g" Makefile
[15:50:24] [INFO] [EXEC] make INSTALL_ROOT=/opt/static-php-cli/buildroot -j16 EXTRA_CFLAGS='-g -Os -fno-ident -fPIE -Xcompiler -march=corei7 -Xcompiler -mtune=core-avx2' EXTRA_LIBS='/opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libfreetype.a /opt/static-php-cli/buildroot/lib/libwebp.a /opt/static-php-cli/buildroot/lib/libwebpdecoder.a /opt/static-php-cli/buildroot/lib/libwebpdemux.a /opt/static-php-cli/buildroot/lib/libwebpmux.a /opt/static-php-cli/buildroot/lib/libsharpyuv.a /opt/static-php-cli/buildroot/lib/libjpeg.a /opt/static-php-cli/buildroot/lib/libturbojpeg.a /opt/static-php-cli/buildroot/lib/libpng16.a /opt/static-php-cli/buildroot/lib/libz.a /opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libjpeg.a /opt/static-php-cli/buildroot/lib/libpng.a /opt/static-php-cli/buildroot/lib/libwebp.a /opt/static-php-cli/buildroot/lib/libfreetype.a /opt/static-php-cli/buildroot/lib/libMagick++-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickWand-7.Q16HDRI.a /opt/static-php-cli/buildroot/lib/libMagickCore-7.Q16HDRI.a -lgomp ' EXTRA_LDFLAGS_PROGRAM=' -all-static' install
[15:50:27] [INFO] running cli sanity check
[15:50:27] [INFO] [EXEC] /opt/static-php-cli/buildroot/bin/php -r "echo \"hello\";"
[15:50:27] [INFO] Build complete, used 120.783 s !
[15:50:27] [INFO] Static php binary path: /opt/static-php-cli/buildroot/bin/php
[15:50:27] [INFO] License path: /opt/static-php-cli/buildroot/license/
alpine:/opt/static-php-cli# cd /opt/frankenphp/caddy/frankenphp/
alpine:/opt/frankenphp/caddy/frankenphp# CGO_CFLAGS="$(/opt/static-php-cli/buildroot/bin/php-config --includes | sed s#-
I/#-I/opt/static-php-cli/buildroot/#g)" CGO_LDFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(/opt/static-php-cli/
buildroot/bin/php-config --ldflags) -Wl,--start-group $(/opt/static-php-cli/buildroot/bin/php-config --libs | sed -e 's/
-lgcc_s//g') -Wl,--end-group" LIBPHP_VERSION="$(/opt/static-php-cli/buildroot/bin/php-config --version)" go buil
d -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -s -w -X '
github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $LIBPHP_VERSION Caddy'"
alpine:/opt/frankenphp/caddy/frankenphp# /opt/static-php-cli/buildroot/bin/php magick.php
�PNG
�
IHDR���7n�$ cHRMz&�����u0�`:��p��Q<�bKGD�݊��
alpine:/opt/frankenphp/caddy/frankenphp# ./frankenphp php-cli magick.php
Segmentation fault
alpine:/opt/frankenphp/caddy/frankenphp# tail magick.php
<?php
$image = new Imagick();
$image->newImage(1, 1, new ImagickPixel('#ffffff'));
$image->setImageFormat('png');
$pngData = $image->getImagesBlob();
echo $pngData;
?>
alpine:/opt/frankenphp/caddy/frankenphp# |
@dunglas I didn't really make progress tracking the error(s) down, but I'm fairly certain that it's limited to libphp.a embedding/FrankenPHP. Using the php-fpm binary or the php-cli binary produced with the same ./configure options for php works just dandy with imagick. For what it's worth, I've tried enabling and disabling threading in the imagemagick library and tried limiting the imagick runtime threads to 1. Also tried with and without the libjpeg library and frankenphp segfaults one way or the other. The imagick extension maintainer doesn't see as any work having to be done with the extension itself, as php-fpm and php-cli work. |
Could you try using the Docker images, which loads libphp as a shared library, to see if it's related to static compilation or not please? |
Err, I'm trying, but I can't seem to get the docker image to actually serve files from my current directory? /opt/frankenphp/caddy/frankenphp/Caddyfile {
{$CADDY_GLOBAL_OPTIONS}
frankenphp {
#worker /path/to/your/worker.php
{$FRANKENPHP_CONFIG}
}
order php_server before file_server
}
{$CADDY_EXTRA_CONFIG}
{$SERVER_NAME:localhost} {
log {
# Redact the authorization query parameter that can be set by Mercure
format filter {
wrap console
fields {
uri query {
replace authorization REDACTED
}
}
}
}
root * /opt/frankenphp/caddy/frankenphp
{$CADDY_SERVER_EXTRA_DIRECTIVES}
encode zstd gzip
php_server
} /opt/frankenphp/caddy/frankenphp/index.php <?php
$image = new Imagick();
$image->newImage(1, 1, new ImagickPixel('#ffffff'));
$image->setImageFormat('png');
$pngData = $image->getImagesBlob();
echo $pngData;
?>
Answers with a phpinfo() response, rather than serving magick.php. Edit: yeah, nevermind, I forgot to map the directory correctly. Either way, imagick does not exist in the phpinfo response, so I wouldn't be able to test if it works. |
You can add imagemagick like this: FROM dunglas/frankenphp
RUN install-php-extensions imagick Then: |
Sorry, I'm not familiar with docker at all. I suppose I edit one of the dockerfiles in the repo root here, or create one myself. Will get it working and report back tomorrow. |
No worries! Just copy the content of the Dockerfile I provided in a file named |
Using FROM dunglas/frankenphp
RUN install-php-extensions
gd \
intl
imagick
[root@alma frankenphp]# curl -k https://localhost/magick.php --output -
�PNG
⸮
IHDR7n�$gAMA��
�a cHRMz&�����u0�`:�p��Q<bKGD݊�
IDA�ch���Cj�IEND�B`�[root@alma frankenphp]# So that works. Seems to be a problem between FrankenPHP and static imagemagick. Either work fine on their own, just not together. What does FrankenPHP do different than php-cli and php-fpm? For what it's worth, a workaround is to run static-php-cli with |
Do you know if the problem still occurs? Static PHP CLI fixed some related issues. |
Only one way to find out! Could you quickly add imagick to the extension list and trigger a frankenphp build? I won't be able to until Monday or Tuesday. |
Closing for now. Please reopen if it happens again. |
A few of my urls, particularly those generating pdf's using Html2pdf/TCPDF crash FrankenPHP. I'll investigate whether this is due to imagick being enabled.
The text was updated successfully, but these errors were encountered: