longxinH / xhprof

PHP7/PHP8 support
http://pecl.php.net/package/xhprof
Apache License 2.0
1.07k stars 166 forks source link

PHP 8 jit + xhprof #51

Closed andypost closed 3 years ago

andypost commented 3 years ago

Just used to try use Drupal 9-dev using JIT and the extension

# php -dopcache.jit_buffer_size=10M -dextension=xhprof -S 0.0.0.0:44543 .ht.router.php 
[Fri Nov 27 14:04:39 2020] PHP 8.0.0 Development Server (http://0.0.0.0:44543) started
[Fri Nov 27 14:04:44 2020] 172.16.0.1:46404 Accepted
Segmentation fault (core dumped)

PS: using latest build packages from Alpinelinux (will check official docker images when they out)

andypost commented 3 years ago

It's using latest releases PHP 8.0.0 and XHProf 2.2.3

longxinH commented 3 years ago

@andypost Can you provide some options for compiling php8? I cannot reproduce the segfault

andypost commented 3 years ago

@andypost Can you provide some options for compiling php8?

All options could be found in https://git.alpinelinux.org/aports/tree/testing/php8/APKBUILD#n215 (PHP) I use no extra options for https://git.alpinelinux.org/aports/tree/testing/php8-pecl-xhprof/APKBUILD#n21

longxinH commented 3 years ago

I used the same source and there was no segfault

PHP 8.0.0 (cli) (built: Nov 26 2020 15:10:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies

[PHP Modules]
Core
ctype
date
filter
hash
json
libxml
pcre
readline
Reflection
SPL
standard
xhprof
zlib

php8 -dopcache.jit_buffer_size=10M -S 0.0.0.0:44543
[Tue Dec  1 11:30:13 2020] PHP 8.0.0 Development Server (http://0.0.0.0:44543) started

[Tue Dec  1 11:30:25 2020] 127.0.0.1:50482 Accepted
[Tue Dec  1 11:30:25 2020] 127.0.0.1:50482 [200]: GET /test.php
[Tue Dec  1 11:30:25 2020] 127.0.0.1:50482 Closing
andypost commented 3 years ago

Thank you, looks it depends on what script is executed, I can reproduce it with Drupal but will try other apps

longxinH commented 3 years ago

@andypost Sorry, I misunderstood what you meant, I should know what's going on

longxinH commented 3 years ago

@andypost I didn't find the corresponding docker image, can you provide it to me?

andypost commented 3 years ago

@longxinH I will dig it this weekend and prepare docker image to easy reproduce

beberlei commented 3 years ago

No need, this is a PHP bug that will be fixed in 8.0.1 https://bugs.php.net/bug.php?id=80426

Edit: Right now having an extension with zend_execute_ex hook and enabling the JIT will always crash.

longxinH commented 3 years ago

@andypost Hello, has the latest version 8.0.2 solved this problem?

andypost commented 3 years ago

Use to try with 8.0.3 and now I see different message

$ docker run --rm -it alpine:edge ash
/ # apk add php8 php8-opcache php8-pecl-xhprof
...
/ # php8 -dopcache.jit_buffer_size=10M -S 0.0.0.0:44543 
[Sat Mar 27 02:49:25 2021] PHP Warning:  JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled. in Unknown on line 0
[Sat Mar 27 02:49:25 2021] PHP 8.0.3 Development Server (http://0.0.0.0:44543) started
^C
andypost commented 3 years ago

btw tideways_xhprof works for some reason (probably because using observer API)

beberlei commented 3 years ago

Yes i added observer API support here https://github.com/tideways/php-xhprof-extension/pull/96

longxinH commented 3 years ago

@andypost Try if it works ?

andypost commented 3 years ago

Will do in 2 hours

andypost commented 3 years ago

@longxinH Thank you a lot! it works on all arches https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/19953 - PHP 7.4 and 8.0 at least, and code changes looks like great clean-up - are you going to release 2.3.0 beta or stable?

longxinH commented 3 years ago

@andypost 2.3.0 I want to release Beta, because there is a lack of a lot of test data

andypost commented 3 years ago

Sure, I used to try add test for opcache but stuck with config

glensc commented 3 years ago

@longxinH I think release is good, as then people come back with bug reports. Unlikely people build from git@HEAD to test things, but installing beta from pecl -> definitely some!

longxinH commented 3 years ago

@glensc Yes, release 2.3.0 Beta in pecl

longxinH commented 3 years ago

@andypost @glensc release https://pecl.php.net/package/xhprof/2.3.0