Skip to content

Fix #80175: PHP8 RC1 - JIT Buffer not works #6268

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

Closed
wants to merge 1 commit into from
Closed

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Oct 3, 2020

On Windows, SUCCESSFULLY_REATTACHED does not imply that the process
has already been properly initialized; thus we must not skip some setup
steps in zend_jit_startup().

On Windows, `SUCCESSFULLY_REATTACHED` does not imply that the process
has already been properly initialized; thus we must not skip some setup
steps in `zend_jit_startup()`.
@nikic nikic requested a review from dstogov October 5, 2020 09:20
@cmb69
Copy link
Member Author

cmb69 commented Oct 6, 2020

As it is now with Apache mpm_winnt, the control process is properly initialized for JIT, but the spawned request handler process is not. For FCGI, only the first php-cgi.exe process is properly initialized, but further processes are not. This causes null pointer accesses later on, because the zend_jit_*_handler callbacks are not initialized.

By the way, having two Apache processes is also the reason why preloading wouldn't even work for Apache on Windows, @nikic.

@cmb69
Copy link
Member Author

cmb69 commented Oct 8, 2020

IMHO it is important to get this fixed for 8.0.0RC2 (which is scheduled for tagging on next Tuesday). If there's anything I can do to help with that, I could spend some time on that on the weekend.

@php-pulls php-pulls closed this in 2a545ba Oct 10, 2020
@cmb69 cmb69 deleted the cmb/80175 branch October 10, 2020 15:48
@celestinoxp
Copy link

Can anyone confirm that it is working now?
It still doesn't work with me.

@cmb69
Copy link
Member Author

cmb69 commented Oct 11, 2020

It still doesn't work with me.

Did you build PHP from the latest Git snapshot?

@celestinoxp
Copy link

celestinoxp commented Oct 11, 2020

Did you build PHP from the latest Git snapshot?

I downloaded (Build PHP nightly for windows) today from https://github.com/shivammathur/php-builder-windows
In phpinfo show:

Build Date: Oct 10 2020 23:38:27 --> Jit buffer size not works

Update:

Build Date: Oct 11 2020 23:38:24 --> Jit buffer size not works

Update

Build Date: Oct 19 2020 23:40:31 --> Jit buffer size still not working

New Question: Maybe it is an apache issue? If yes, can anyone contact apache team to support jit?

@celestinoxp
Copy link

Bug #80175 | PHP8 RC1 - JIT Buffer not working
Bug #80243 | OPCache JIT segfaults at startup

Fixed with: 5998b2a

@dktapps
Copy link
Contributor

dktapps commented Jun 28, 2021

This change appears to be the underlying cause of https://bugs.php.net/bug.php?id=81206. It would seem a more fine-grained fix for this problem is needed.

@cmb69
Copy link
Member Author

cmb69 commented Jun 28, 2021

I won't have time to look into this, but I generally recommend to not share OPcache instances between unrelated processes (that only happens on Windows); you can use opcache.cache_id to enforce this.

@dktapps
Copy link
Contributor

dktapps commented Jun 29, 2021

In this case the processes aren't unrelated - I found the bug using phpstan, which uses subprocesses to parallelize static analysis, and which is crippled on JIT due to this change.
This change breaks pretty much every use case of subprocesses on Windows that isn't Apache.

cmb69 added a commit to cmb69/php-src that referenced this pull request Jun 29, 2021
The fix for bug 80175 (PR php#6268) broke most SAPIs wrt. JIT, most
notably cgi-fcgi, because for these SAPIs `SUCCESSFULLY_REATTACHED`
actually has to set the `reattached` flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants