Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Apache graceful causes zombie processes when vips module loaded #26

Description

@jesseforrest

I'm not sure if this php-vips project is the most appropriate forum to writeup this bug report, but I'm not sure where else would be appropriate.

We're trying to get Vips to work with:

  • Ubuntu 14.04.1 LTS
  • Apache 2.4
  • PHP 7.0

We tried to follow the guidelines as instructed in the main readme here:
https://github.com/jcupitt/php-vips

In doing so, we were able to get Apache to run appropriately with the Vips C executable, the PECL module, and your php-vips composer package:

- name: Stop Apache
  shell: service apache2 stop

- name: VIPS Requirements
  apt: name="{{ item }}" state=latest
  with_items:
  - build-essential
  - pkg-config
  - libglib2.0-dev
  - libxml2-dev
  - libtiff5-dev
  - libjpeg-turbo8-dev
  - libgsf-1-dev
  - libvips-dev

- name: Download libvips package
  command: aws s3 cp s3://our-3rd-party-software-repo/vips/vips-8.3.3.orig.tar.gz /tmp/vips-8.3.3.tar.gz
  sudo: yes
  sudo_user: "{{ s3_user }}"

- name: Untar libvips package
  unarchive: src=/tmp/vips-8.3.3.tar.gz dest=/tmp/ copy=no
  sudo: no

- name: Make libvips
  shell: cd /tmp/vips-8.3.3 && ./configure && make

- name: Make install libvips
  shell: cd /tmp/vips-8.3.3 && make install
  sudo: yes

- file: path=/tmp/vips-8.3.3 state=absent

- file: path=/tmp/vips-8.3.3.tar.gz state=absent

- name: Install the binary PHP extension
  shell: /usr/bin/yes '' | pecl install vips
  sudo: yes

- name: Include extension in php.ini
  lineinfile: dest={{ php_ini_apache_path }} regexp='^\[vips\]' line='[vips]'
- lineinfile: dest={{ php_ini_apache_path }} insertafter='^\[vips\]' regexp='^extension=vips.so' line='extension=vips.so'
- lineinfile: dest={{ php_ini_cli_path }} regexp='^\[vips\]' line='[vips]'
- lineinfile: dest={{ php_ini_cli_path }} insertafter='^\[vips\]' regexp='^extension=vips.so' line='extension=vips.so'

- name: Start Apache
  shell: service apache2 start

Everything works beautifully, except when we run an apache2ctl graceful. As soon as we run a graceful, Apache no longer works and we end up with zombie processes.

For example, after provisioning completes, it works and looks healthy:

05:38 PM vagrant@dev:[~]: ps aux | grep apache
root     28121  0.2  0.6 581932 49412 ?        Ss   17:38   0:00 /usr/sbin/apache2 -k start
www-data 28468  0.5  0.3 584504 29472 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28469  0.3  0.3 583900 31360 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28470  0.8  0.3 583764 29988 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28471  0.0  0.1 581964 13344 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28472  0.0  0.1 582164 16088 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28542  0.0  0.1 581964 13344 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28546  0.0  0.1 581964 13344 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28549  0.0  0.1 581964 13344 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28610  0.0  0.1 581964 13344 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
vagrant  28847  0.0  0.0  14120  2304 pts/1    R+   17:38   0:00 grep --color=auto apache

Then when we run apache2ctl graceful, Apache becomes unresponsive and we end up with zombie processes:

05:38 PM vagrant@dev:[~]: sudo apache2ctl graceful
05:39 PM vagrant@dev:[~]: ps aux | grep apache
root     28121  0.2  0.4 483124 34008 ?        Ss   17:38   0:00 /usr/sbin/apache2 -k start
www-data 28468  0.4  0.3 584504 29472 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28469  0.2  0.3 583900 31360 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28470  0.6  0.3 583764 29988 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28471  0.0  0.0      0     0 ?        Z    17:38   0:00 [apache2] <defunct>
www-data 28472  0.0  0.1 582164 16088 ?        S    17:38   0:00 /usr/sbin/apache2 -k start
www-data 28542  0.0  0.0      0     0 ?        Z    17:38   0:00 [apache2] <defunct>
www-data 28546  0.0  0.0      0     0 ?        Z    17:38   0:00 [apache2] <defunct>
www-data 28549  0.0  0.0      0     0 ?        Z    17:38   0:00 [apache2] <defunct>
www-data 28610  0.0  0.0      0     0 ?        Z    17:38   0:00 [apache2] <defunct>
vagrant  29023  0.0  0.0  14120  2304 pts/1    R+   17:39   0:00 grep --color=auto apache

What's stranger, is that if we simply run apache2ctl stop and then apache2ctl start, everything looks fine. However, when we deploy to production we need to run a graceful to make sure we don't kill live requests.

When we look at apache error logs, this is the error that appears:

05:39 PM vagrant@dev:[~]: tail -f /var/log/apache2/error.log
[Mon Dec 19 17:38:32.002616 2016] [core:notice] [pid 28121] AH00094: Command line: '/usr/sbin/apache2'
[Mon Dec 19 17:39:01.671918 2016] [mpm_prefork:notice] [pid 28121] AH00171: Graceful restart requested, doing restart

(banana:28121): GLib-GObject-WARNING **: cannot register existing type 'VipsObject'

(banana:28121): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(banana:28121): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed

(banana:28121): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

Any help would be appreciated. We would really like to use Vips with PHP 7 on Apache, but unless we can solve this problem it looks to be a deal breaker.

The only other thing we were confused by was whether or not we needed to install libvips by apt-get install libvips-dev and/or vips-8.3.3.tar.gz (from source). The Ansible playbook above does both.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions