Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Custom CSS: HHVM 3.8.0 + SaSS results in segfault #2431

Closed mrteera closed 9 years ago

mrteera commented 9 years ago

Summary of the issue: HHVM 3.8.0 produces a error with Jetpack 3.6 Expected behavior or result: HHVM should work fine Actual behavior or result: An error appears: Core dumped: Segmentation fault.

Environment:

We can perfectly use Jetpack with HHVM 3.6. But when we upgrade HHVM to 3.8.0. HHVM has Core dumped: Segmentation fault. The errors in stack trace is about Jetpack:

PHP Stacktrace:

#0  csstidy->parse(@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic);
...

, , less) called at [/var/www/wordpress/wp-content/plugins/jetpack/modules/custom-css/custom-css.php:272]
#3  Jetpack_Custom_CSS::save(Array) called at [/var/www/wordpress/wp-content/plugins/jetpack/modules/custom-css/custom-css.php:100]
#4  Jetpack_Custom_CSS::init() called at [/var/www/wordpress/wp-includes/plugin.php:496]
#5  do_action(init) called at [/var/www/wordpress/wp-settings.php:353]
#6  include(/var/www/wordpress/wp-settings.php) called at [/var/www/wordpress/conf/wp-config.php:142]
#7  include(/var/www/wordpress/conf/wp-config.php) called at [/var/www/wordpress/wp-load.php:37]
#8  include(/var/www/wordpress/wp-load.php) called at [/var/www/wordpress/wp-admin/admin.php:31]
#9  include(/var/www/wordpress/wp-admin/admin.php) called at [/var/www/wordpress/wp-admin/themes.php:10]

Here's the full log file: https://gist.github.com/mrteera/339385cbdab14d2ec465

kraftbj commented 9 years ago

I was able to duplicate this, specifically when adding the CSS provided in the full error and using SASS precompiler. I haven't narrowed down if there is something specific in the SASS causing the issue.

I'd like to shake it down a bit on if this is our issue or HHVM's.

zinigor commented 9 years ago

I narrowed the cause down, you have two missing semicolons in your LESS code. This makes the LESS preprocessor fail and just feed LESS code into csstidy, upon which it segfaults. @mrteera can you please do me a favor and try to run this file on your environment where you have HHVM 3.6?

You will need to put two files in the root of your WP installation: https://gist.github.com/zinigor/5a7347d0718f45a95894 and https://gist.github.com/zinigor/709f337d2a3895dfdd86 . After that run them using HHVM and WP-CLI: hhvm wp-cli.phar parse.php or just wp parse.php if you already have WP-CLI set up to use HHVM binary.

If you do not get a segfault on 3.6, this must mean that there is a regression in HHVM.

Please let me know if you need any help and thank you!

zinigor commented 9 years ago

Related: #896

mrteera commented 9 years ago
$ hhvm wp-cli.phar parse.php
Error: 'parse.php' is not a registered wp command. See 'wp help'.

Maybe I need to register the command.

mrteera commented 9 years ago

Ok, I got it. I include parse.php inside wp-content/plugins/jetpack/modules/custom-css/custom-css.php.

Here's HHVM 3.6.5

$ hhvm ./wp-cli.phar parse.php
LESS execution failed@baseColor : #973b22
@darkerColor: #ffffff
a{color:@baseColor;background:@darkedColor}Error: 'parse.php' is not a registered wp command. See 'wp help'.

Here's HHVM 3.8.0

$ hhvm ./wp-cli.phar parse.php
LESS execution failed[Thu Jul 23 02:30:37 2015] [hphp] [25509:7f6b70c649c0:0:000001] [] Core dumped: Segmentation fault
[Thu Jul 23 02:30:37 2015] [hphp] [25509:7f6b70c649c0:0:000002] [] Stack trace in /tmp/stacktrace.25509.log
Segmentation fault (core dumped)
zinigor commented 9 years ago

@mrteera Thank you for doing that! My bad, the command should have been hhvm ./wp-cli.phar eval-file parse.php, but I see you got it working anyway. So it looks like a regression in hhvm, I'm closing this issue as wontfix, and I have created an issue in the HHVM repository as well: https://github.com/facebook/hhvm/issues/5777

alexphelps commented 9 years ago

@zinigor Thanks for reporting to HHVM for us. We'll keep an eye out on their updates.