Skip to content
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

Migrating CiviCRM to BOA can result in php segfaults #686

Closed
ar-jan opened this issue Apr 16, 2015 · 3 comments
Closed

Migrating CiviCRM to BOA can result in php segfaults #686

ar-jan opened this issue Apr 16, 2015 · 3 comments

Comments

@ar-jan
Copy link
Contributor

ar-jan commented Apr 16, 2015

This is to document a problem one may run into when migrating a site with CiviCRM to BOA. Maybe it'll save someone some time...

TLDR: replace any file paths in the database dump of your civicrm tables with valid paths on the destination before importing, to prevent infinite retries in combination with open_basedir restrictions.

When I migrated a Drupal 7 site with CiviCRM 4.5 to a BOA (2.4.1), this lead to a php segfault when interacting with the site via drush, manifested as 502 Bad Gateway message when viewing the site.

I'd previously had the same problem with another site, which then magically went away after I'd upgraded to PHP 5.5 and MariaDB 10.0. This time that didn't help though.

  • The CiviCRM tables had been exported with some data excluded (e.g. civicrm_domain, after this doc)

  • When importing the site without the CiviCRM tables it worked fine

  • When importing CiviCRM tables as well, I got either a 502 Bad Gateway, or occasionally, 504 Gateway Time-out instead when viewing the site in the browser.

    o1.ftp:[www.example.com]$ drush rr
    The registry has been rebuilt via registry_rebuild (A). [success]
    Segmentation fault

  • Logs:
    /var/log/php/fpm-o1-slow.log: empty
    /var/log/php/fpm-www55-slow.log: empty
    /var/log/php/php55-fpm-error.log:
    [09-Apr-2015 19:01:50] WARNING: [pool o1] child 19216 exited on signal 11 (SIGSEGV) after 5886.004676 seconds from start
    /var/log/mysql.err: empty
    /var/log/mysql.log: empty
    /var/log/nginx/error.log: empty
    tail -f /var/log/syslog:
    Apr 9 19:01:50 web03 kernel: [1188782.848156] php-fpm[19216]: segfault at 7ffe45708f68 ip 0000000000780c3e sp 00007ffe45708f30 error 6 in php-fpm[400000+996000]
    Apr 9 19:01:50 web03 mysqld: 150409 19:01:50 [Warning] Aborted connection 135968 to db: 'sitenameo1web03' user: 'sitenameo1web03' host: 'localhost' (Unknown error)

  • I also searched for files of size 4096 or 8192 as described in the email sent by BOA monitor, there weren't any:

    See the reports linked below to learn more:
    https://bugs.php.net/bug.php?id=48034
    https://drupal.org/node/1462984#comment-5790468
    https://drupal.org/node/1366084#comment-5877974

Finally I noticed in /var/log/syslog loads of these messages:

Apr 10 18:54:02 web03 drupal: http://test.dev.sitename.o1.web03.example.com|1428684842|php|213.125.184.74|http://test.dev.sitename.o1.web03.example.com/en||0||Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.:/data/disk/o1/distro:/data/disk/o1/static:/data/disk/o1/aegir:/data/disk/o1/platforms:/data/disk/o1/backup-exports:/home/o1.web/.tmp:/home/o1.web/.aws:/data/all:/data/disk/all:/data/conf:/var/second/o1:/mnt:/srv:/usr/bin:/opt/tika:/opt/tika7:/opt/tika8:/opt/tika9:/opt/php53:/opt/php54:/opt/php55:/opt/php56) in CRM_Utils_File::createDir() (line 109 of /data/disk/o1/static/platforms/drupal-civi-7.34.1-prod/sites/all/modules/civicrm/CRM/Utils/File.php).

Followed eventually by:
Apr 10 18:54:02 web03 rsyslogd-2177: imuxsock begins to drop messages from pid 32749 due to rate-limiting

I don't know why I missed these before (I didn't see these messages at other moments when I was tailing the logs while testing), but indeed, after further cleaning of the civicrm database dump, replacing non-existent paths like /home/someuser/domains/example.com/public_html with /data/disk/o1/static/platforms/myplatform the imported site worked OK.

I'm still wondering how it's possible the import sometimes works without replacing these paths (with the exact same database dump), giving you a chance to adjust incorrect file paths via the CiviCRM UI.
Not sure if this is also a bug in CiviCRM (i.e. should it keep trying to access non-accessible paths), or if there's something that could be done in BOA to provide a more visible error to the user.

@omega8cc
Copy link
Owner

This looks like a wiki entry candidate? Fixing such problems is beyond BOA and Aegir scope, because there is no way it could be fixed automatically.

@ar-jan
Copy link
Contributor Author

ar-jan commented Apr 16, 2015

Sure, added https://github.com/omega8cc/boa/wiki/Migrating-a-site-with-CiviCRM-to-BOA. I think it can be useful to have a ticket in the issue queue in case anyone searches for segfaults here (like I did).

@omega8cc
Copy link
Owner

OK, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants