ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Segmentation fault, PHP 7.4, Alpine
Posted by ML on Sep-27-2020 11:59
Hey there, we just migrated our PHP 7.4 app from CentOS to Alpine (Docker), and we're getting a nasty error:

Thread 1 "httpd" received signal SIGSEGV, Segmentation fault.
0x00000000000c845e in ?? ()
(gdb) backtrace full
#0  0x00000000000c845e in ?? ()
No symbol table info available.
#1  0x00007efc9b2d05ce in ?? () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#2  0x00007efc9b3244de in ?? () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#3  0x00007efc9b2cd8bf in ?? () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#4  0x00007efc9b2cd9bb in ?? () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#5  0x00007efc9b3d22ed in ?? () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#6  0x00007efc9b34e689 in runMethod () from /usr/lib/php7/modules/libchartdir.so
No symbol table info available.
#7  0x00007efc9b871499 in zif_callmethod () from /usr/lib/php7/modules/phpchartdir740.dll
No symbol table info available.
#8  0x00007efc9cc27972 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER () at /home/buildozer/aports/community/php7/src/php-7.4.10/Zend/zend_vm_execute.h:1314
        call = 0x7efc9c411350
        fbc = <optimized out>
        ret = <optimized out>
        retval = <optimized out>
#9  execute_ex (ex=<optimized out>) at /home/buildozer/aports/community/php7/src/php-7.4.10/Zend/zend_vm_execute.h:53748
        orig_opline = 0x7ffe08192c08
        orig_execute_data = 0x0
#10 0x00007efc9cc30416 in zend_execute (op_array=0x7efc9c468000, return_value=0x0) at /home/buildozer/aports/community/php7/src/php-7.4.10/Zend/zend_vm_execute.h:57864
        execute_data = 0x7efc9c411020
        object_or_called_scope = <optimized out>
        call_info = <optimized out>
#11 0x00007efc9cbc1fb1 in zend_execute_scripts (type=type@entry=8, retval=0x7efc9c411250, retval@entry=0x0, file_count=file_count@entry=3)
    at /home/buildozer/aports/community/php7/src/php-7.4.10/Zend/zend.c:1677
--Type <RET> for more, q to quit, c to continue without paging--c
        files = {{gp_offset = 40, fp_offset = 2004317999, overflow_arg_area = 0x7ffe08190900, reg_save_area = 0x7ffe08190890}}
        i = 1
        file_handle = 0x7efc139ad730
        op_array = 0x7efc9c468000
#12 0x00007efc9cb71f39 in php_execute_script (primary_file=primary_file@entry=0x7ffe08192c08) at /home/buildozer/aports/community/php7/src/php-7.4.10/main/main.c:2621
        realfile = "0000000000000000s3431b376177000000 H234374~0000s3431b376177000035330270234374~0000 7E234374~0000`4G234374~000000000000000000000500000000000000020000000000000022261270234374~0000 7E234374~0000`y237233374~00000100000000000000010000000000000000`H234374~0000 377F234374~00000100000000000000 27W234374~00000100000000000000230244]5345345%2452703431b376177000000376F234374~000000 H234374~0000 7E234374~0000"...
        __orig_bailout = 0x7ffe08192c58
        __bailout = {{__jb = {7, 140729034288016, 140729034288136, 0, 140729034288980, 5000000, 140729034279168, 139623426104538}, __fl = 0, __ss = {7526756837603942432, 94619973205152, 139623418258240, 139623428775720, 134217728, 140729034284152, 139623428800192, 7, 140729034288144, 140729034288264, 0, 140729034288980, 5000000, 140729034279296, 139623426104538, 139623430581900}}}
        prepend_file_p = 0x0
        append_file_p = 0x0
        prepend_file = {handle = {fp = 0x58582e6d6553646e, stream = {handle = 0x58582e6d6553646e, isatty = 1482184792, reader = 0x7efc9cfb74c9 <malloc+901>, fsizer = 0x7efc9cce696c, closer = 0x40}}, filename = 0x1100000000 <error: Cannot access memory at address 0x1100000000>, opened_path = 0x0, type = ZEND_HANDLE_FP, free_filename = 14 '16', buf = 0x560e6dd6a8e0 "01", len = 94619972074112}
        append_file = {handle = {fp = 0x7efc9cfe1156, stream = {handle = 0x7efc9cfe1156, isatty = 135867608, reader = 0x108191b68, fsizer = 0x7ffe08190980, closer = 0x7ffe08192c88}}, filename = 0x7ffe081919e0 "220+31b376177", opened_path = 0x7efc9cfdf1c0 <vfprintf+294>, type = (ZEND_HANDLE_FP | ZEND_HANDLE_STREAM | unknown: 2621306960), free_filename = 252 '374', buf = 0x7efc9cd2594d "    with %s v%s, %s, by %sn", len = 140728898420736}
        old_cwd = 0x7ffe08190900 "/var/www/html"
        retval = 0
#13 0x00007efc9cc31a0a in php_handler (r=0x560e6df868a8) at /home/buildozer/aports/community/php7/src/php-7.4.10/sapi/apache2handler/sapi_apache2.c:700
        zfd = {handle = {fp = 0x0, stream = {handle = 0x0, isatty = 0, reader = 0x0, fsizer = 0x0, closer = 0x0}}, filename = 0x560e6df877f8 "/var/www/html/httpdocs/dynamic/pricepaidhistory.php", opened_path = 0x0, type = ZEND_HANDLE_FILENAME, free_filename = 0 '00', buf = 0x0, len = 0}
        __orig_bailout = 0x0
        __bailout = {{__jb = {7, 94619974532368, 94619971621360, 0, 140729034288980, 5000000, 140729034288032, 139623426889675}, __fl = 94619965533864, __ss = {0, 11900170363002004632, 140729034288572, 139623421136755, 2, 139623429027519, 140729034288596, 0, 94619971811048, 94619974468520, 94619974490448, 139623429757986, 18446744069414584321, 139623430761041, 3, 139623429759873}}}
        ctx = 0x560e6df87e30
        conf = 0x560e6dceabd8
        brigade = 0x560e6de42d90
        bucket = <optimized out>
        rv = <optimized out>
        parent_req = 0x0
#14 0x0000560e6d709b5a in ap_run_handler ()
No symbol table info available.
#15 0x0000560e6d709f9d in ap_invoke_handler ()
No symbol table info available.
#16 0x0000560e6d71b476 in ap_internal_redirect ()
No symbol table info available.
#17 0x00007efc9ce17f71 in ?? () from /var/www/modules/mod_rewrite.so
No symbol table info available.
#18 0x0000560e6d709b5a in ap_run_handler ()
No symbol table info available.
#19 0x0000560e6d709f9d in ap_invoke_handler ()
No symbol table info available.
#20 0x0000560e6d71c061 in ap_process_async_request ()
No symbol table info available.
#21 0x0000560e6d71c0ff in ap_process_request ()
No symbol table info available.
#22 0x0000560e6d718ed0 in ?? ()
No symbol table info available.
#23 0x0000560e6d7119de in ap_run_process_connection ()
No symbol table info available.
#24 0x00007efc9cea7302 in ?? () from /var/www/modules/mod_mpm_prefork.so
No symbol table info available.
#25 0x00007efc9cea748f in ?? () from /var/www/modules/mod_mpm_prefork.so
No symbol table info available.
#26 0x00007efc9cea74dd in ?? () from /var/www/modules/mod_mpm_prefork.so
No symbol table info available.
#27 0x00007efc9cea7a7c in ?? () from /var/www/modules/mod_mpm_prefork.so
No symbol table info available.
#28 0x0000560e6d6f0ed5 in ap_run_mpm ()
No symbol table info available.
#29 0x0000560e6d6eae58 in main ()
No symbol table info available.

This error is particularly nasty because it seems to crash the Apache process completely, so unrelated pages on the site 502 until the container can restart.

I saw your post about Alphine possibly missing some dependencies and we're going to do our best to add them, but we're kind of shooting in the dark, here. Any chance we can ask you to provide a dll compatible with Alpine, or else tell us exactly what needs to be available?

  Re: Segmentation fault, PHP 7.4, Alpine
Posted by Peter Kwan on Sep-28-2020 20:09
Hi ML,

We have tested ChartDirector on a lot of Linux machines or Linux virtual machines. However, for Docker, we have never used it before. I will set up a Docker environment to test it.

Regards
Peter Kwan

  Re: Segmentation fault, PHP 7.4, Alpine
Posted by ML on Sep-29-2020 00:42
Peter Kwan wrote:

Hi ML,

We have tested ChartDirector on a lot of Linux machines or Linux virtual machines. However, for Docker, we have never used it before. I will set up a Docker environment to test it.

Regards
Peter Kwan

Glad to hear it. Please reach out for specifics or if you would like me to provide our docker file.

  Re: Segmentation fault, PHP 7.4, Alpine
Posted by Peter Kwan on Sep-29-2020 21:21
Hi ML,

Unluckily, from our testing, it is very difficult if not impossible for the current ChartDirector to run on Apline Linux. Would you consider to use CentOS (or other regular Linux OS) on Docker instead?

From our testing, ChartDirector can work normally in a Docker container if a regular Linux (the ones like CentOS, RedHat, Ubuntu, Debian, Fedora) is used.

The Apline Linux is a very compact Linux distribution. It's web site mentioned that it can fit within 8MB in a container. Apline Linux uses a C runtime called "musl", as opposed to the GNU C runtime "glibc". Unluckily, the two C runtimes are not binary compatible. That means any executable compiled in a "regular" Linux is unlikely to run on Apline Linux directly.

Whereas it may be possible to work around by downloading additional "compatibility layer" packages to Apline, it only works at the "process" level. That means you cannot use a "musl" PHP to load a "glibc" shared object. The entire applicable must use the same kind of C runtime.

Personally, I think if you are running on PC or server type hardware (as opposed to embedded system like a Wifi router), the size of a regular Linux Docker image is acceptable. The PHP is modern regular Linux should be "isolated", which errors in one PHP page cannot pull down the entire Apache. (The Apline PHP is of "mod_php7" type, which is fast and small but is not isolated. That's why one page can pull down the entire Apache. Modern Linux typically use FPM or FastCGI PHP, which is more robust.)

Regards
Peter Kwan