Segfault of PHP when running Menalto Gallery3

General discussion on Zend Guard / Optimizer

Segfault of PHP when running Menalto Gallery3

Postby wido_den_hollander on Sun Apr 24, 2011 12:00 am

Hi all,

We've got various complaints of our customers reporting "blank pages" with their Menalto Gallery3 photo albums after our upgrade to PHP 5.3

After some debugging I found that it was due to the combination of having the Zend Guard loader configured and running Gallery 3.

My GDB tells me:

Code: Select all
(gdb) run index.php
Starting program: /usr/bin/php index.php
[Thread debugging using libthread_db enabled]
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imap.ini on line 1 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[New Thread 0x7fffebae3700 (LWP 6018)]
[Thread 0x7fffebae3700 (LWP 6018) exited]

Program received signal SIGSEGV, Segmentation fault.
zend_hash_exists (ht=0x7757c13450b0c632, arKey=0x15a08b8 "gallery_ready", nKeyLength=14) at /build/buildd/php5-5.3.2/Zend/zend_hash.c:1134
1134   /build/buildd/php5-5.3.2/Zend/zend_hash.c: No such file or directory.
   in /build/buildd/php5-5.3.2/Zend/zend_hash.c
(gdb) bt
#0  zend_hash_exists (ht=0x7757c13450b0c632, arKey=0x15a08b8 "gallery_ready", nKeyLength=14) at /build/buildd/php5-5.3.2/Zend/zend_hash.c:1134
#1  0x00007ffff42dee6d in ?? () from /usr/local/lib/ZendGuardLoader.so
#2  0x00000000006e7caa in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffeb04c988) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:313
#3  0x00000000006bef90 in execute (op_array=0x142de58) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#4  0x00007ffff42dfaa6 in zend_oe () from /usr/local/lib/ZendGuardLoader.so
#5  0x00000000006e77b6 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffeb04c818) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:337
#6  0x00000000006bef90 in execute (op_array=0x15ad528) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#7  0x00007ffff42dfaa6 in zend_oe () from /usr/local/lib/ZendGuardLoader.so
#8  0x000000000068cda4 in zend_call_function (fci=0x7fffffffb980, fci_cache=0x7fffeb04c378) at /build/buildd/php5-5.3.2/Zend/zend_execute_API.c:947
#9  0x00000000005cd9e7 in zif_call_user_func_array (ht=1353762354, return_value=0x13cea70, return_value_ptr=0xe, this_ptr=0x0, return_value_used=-12928964)
    at /build/buildd/php5-5.3.2/ext/standard/basic_functions.c:4782
#10 0x00007ffff42df5a9 in ?? () from /usr/local/lib/ZendGuardLoader.so
#11 0x00000000006e7caa in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffeb04c378) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:313
#12 0x00000000006bef90 in execute (op_array=0x1212a10) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#13 0x00007ffff42dfaa6 in zend_oe () from /usr/local/lib/ZendGuardLoader.so
#14 0x00000000006e77b6 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffeb04b830) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:337
#15 0x00000000006bef90 in execute (op_array=0x11efac0) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#16 0x00007ffff42dfaa6 in zend_oe () from /usr/local/lib/ZendGuardLoader.so
#17 0x00000000006cab3f in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER (execute_data=0x7fffeb04b068) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:5219
#18 0x00000000006bef90 in execute (op_array=0x11ee428) at /build/buildd/php5-5.3.2/Zend/zend_vm_execute.h:104
#19 0x00007ffff42dfaa6 in zend_oe () from /usr/local/lib/ZendGuardLoader.so
#20 0x0000000000696bad in zend_execute_scripts (type=0, retval=0x7fffffffbf60, file_count=3) at /build/buildd/php5-5.3.2/Zend/zend.c:1266
#21 0x00000000006427a8 in php_execute_script (primary_file=0x6bdf2e) at /build/buildd/php5-5.3.2/main/main.c:2288
#22 0x0000000000727dc6 in main (argc=0, argv=0x1) at /build/buildd/php5-5.3.2/sapi/cli/php_cli.c:1196
(gdb)


My dmesg then tells me:

Code: Select all
php[6010] general protection ip:6a4abb sp:7fff3b82dbf0 error:0 in php5[400000+70d000]


I changed the index.php from Gallery a bit to be able to run it through the CLI.

The system configurations we are running this on:

* Ubuntu 10.04.2 (AMD64)
* PHP 5.3.2 (from Ubuntu 10.04)
* libapache2-mod-php5
* php5-cli
* php5-common
* php5-curl
* php5-dbg
* php5-dev
* php5-gd
* php5-imagick
* php5-imap
* php5-ldap
* php5-mcrypt
* php5-memcache
* php5-mysql
* php5-sqlite
* php5-tidy
* php5-xsl
* Zend Guard Loader (v 3.3)
* Gallery 3.0.1

This combination causes the backtrace you see above, taking out Zend Guard from the mix resolves the issue.

To me it seems like a bug in the Zend Guard loader, but since it's closed source I can't be sure if it is.

Is this the right channel to submit this bug? If so, I hope this information is enough to solve this bug.
wido_den_hollander
 
Posts: 5
Joined: Sat Apr 23, 2011 11:53 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby kentatzend on Mon Apr 25, 2011 4:36 pm

The files have to be specifically coded to run under PHP 5.3 so if you just upgraded your Server to PHP 5.3 and didn't get the files re-encoded for 5.3 then it's not going to work.
User avatar
kentatzend
 
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby wido_den_hollander on Mon Apr 25, 2011 6:41 pm

Gallery3 is not encoded at all, but just having the Zend Guard loader enabled causes PHP to crash.
wido_den_hollander
 
Posts: 5
Joined: Sat Apr 23, 2011 11:53 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby kentatzend on Mon Apr 25, 2011 6:54 pm

Ok so what is the simplest possible configuration to reproduce?
User avatar
kentatzend
 
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby wido_den_hollander on Mon Apr 25, 2011 7:39 pm

Thank you!

Here are the steps to reproduce:

1. Install a Ubuntu 10.04 server (AMD64)
2. Install Apache, mod_php and MySQL via apt-get
3. Download the Zend Guard loader and load it by creating /etc/php5/conf.d/zend.ini
4. Download Menalto Gallery 3.01 and install it

You will see that the install works, but as soon as you are redirected to the Gallery after the installation, Apache segfaults.
wido_den_hollander
 
Posts: 5
Joined: Sat Apr 23, 2011 11:53 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby kentatzend on Mon Apr 25, 2011 7:41 pm

Any other configuration changes? what is the exact content of the zend.ini file?
User avatar
kentatzend
 
Posts: 1778
Joined: Thu Dec 11, 2008 1:08 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby wido_den_hollander on Mon Apr 25, 2011 8:13 pm

No, I'm using the default php.ini shipped with Ubuntu.

De zend.ini contains:

Code: Select all
[Zend]
zend_extension=/usr/local/lib/ZendGuardLoader.so
; Enables loading encoded scripts. The default value is On
zend_loader.enable=1
; Disable license checks (for performance reasons)
zend_loader.disable_licensing=0
wido_den_hollander
 
Posts: 5
Joined: Sat Apr 23, 2011 11:53 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby zvika on Thu Apr 28, 2011 9:27 am

Hi

I tried to install Gallery on Ubuntu 10.04.2 64-bit with Zend Server PHP 5.2.17, and experienced unstable behavior starting the front page of gallery3 (even on other scripts until all Apache processes recycled).

I'm getting myself a new Ubuntu 10.04.2 64-bit vm to run some sanity tests against the gallery 3.0.1.
I will update this post as soon as I have some debugging results (hopefully a couple of hours).

[UPDATE]
Zend Server PHP with gallery 3 is stable after Apache restart. This might not be related to your report at all, please disregard.

I finished testing Ubuntu LAMP with Zend Loader 3.3 - reproduced the crash and.

I am guessing you are ok with Zend Loader disabled for now? You seem to be running non encoded gallery app.

Thanks for the report!
Zvika Dror
Zend Support Team
User avatar
zvika
Zend Global Support
 
Posts: 960
Joined: Sun Dec 14, 2008 9:48 am

Re: Segfault of PHP when running Menalto Gallery3

Postby wido_den_hollander on Fri May 13, 2011 3:48 am

zvika wrote:Hi

I tried to install Gallery on Ubuntu 10.04.2 64-bit with Zend Server PHP 5.2.17, and experienced unstable behavior starting the front page of gallery3 (even on other scripts until all Apache processes recycled).

I'm getting myself a new Ubuntu 10.04.2 64-bit vm to run some sanity tests against the gallery 3.0.1.
I will update this post as soon as I have some debugging results (hopefully a couple of hours).

[UPDATE]
Zend Server PHP with gallery 3 is stable after Apache restart. This might not be related to your report at all, please disregard.

I finished testing Ubuntu LAMP with Zend Loader 3.3 - reproduced the crash and.

I am guessing you are ok with Zend Loader disabled for now? You seem to be running non encoded gallery app.

Thanks for the report!

Sorry for my late response, never saw your update!

I have disabled the loader for now, but there are some customers who are using it, it's a shared system. We had to move them to other servers to facilitate them.
wido_den_hollander
 
Posts: 5
Joined: Sat Apr 23, 2011 11:53 pm

Re: Segfault of PHP when running Menalto Gallery3

Postby propcgamer on Wed May 25, 2011 4:47 am

I registered to say I uncovered the same issue as wido_den_hollander.

The only difference is we compile php,mysql,apache from source.
Apache: 2.2.19
PHP: 5.3.6
MySQL: 5.1.57

Zend Engine v2.3.0
with the ionCube PHP Loader v4.0.8
Zend Guard loader

Once I disabled Zend Guard loader, Gallery 3 worked fine. Before it was segfaulting httpd and displaying a blank page with no errors in the log files.
propcgamer
 
Posts: 1
Joined: Wed May 25, 2011 4:43 am

Next

Return to Zend Guard / Optimizer

Who is online

Users browsing this forum: No registered users and 2 guests