-
Notifications
You must be signed in to change notification settings - Fork 7.8k
php8ts crashes in php_clear_stat_cache() #18145
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
Comments
cc @bukka, might have some idea whether it is related to last change in this area. |
I have been looking into this and it seems like the new cache clearance is causing this. But after going couple of time through the code paths, I can't understand why this is crashing. The stack text is not that helpful as it's not proper stack trace so I can't really see the full path from it. But it looks like it's happening during sapi activate but the strange thing that all the new stream clearances happen only if The solution would be revert that stream part but I would like to first try to figure out what's going on. @jjdunn Can you see some other issues in the logs (e.g. some memory limit or other fatal error around the same time)? Could you you also share your httpd.conf and tell us how often do you see those crashes compare to the other traffic? Btw. there are some known issue with mod_event (assuming that's what you use) so it might be also related to this but not sure. |
@jjdunn, please also install the suitable debug pack (likely https://windows.php.net/downloads/releases/php-debug-pack-8.3.19-Win32-vs16-x64.zip), so we get a better stack backtrace. |
Hi @bukka and @cmb69 - Thank you very much for investigating this problem !
we are not using mod_event
attached please find sanitized versions of httpd.conf and httpd-vhosts.conf, with only the host which is crashing included (suffix .txt added so this ticket system will allow upload) httpd.conf.txt
there is nothing unusual in the apache Access logs
there is nothing relevant in the logs generated by the PHP application we have a page-based PHP / HTML / CSS app built using the Yii 1.1 framework; but there's an embedded single-page javascript app (no framework). The js app does server callbacks to get/save data. We just installed a new version of the js app (yesterday on the Test server, today on the Prod server). When the js app opens it fetches the data, and immediately tries to save. One of these operations is failing. It's unclear if there's a bug in the js app - it works fine on the lead developer's local environment; and works fine in my development environment; and now (weirdly) works fine in Test. (I reverted Prod to the prior version). We don't yet know if there's an application-code error; but in any case I would not expect PHP to crash even if there were. @cmb69 wrote:
I can do this in my local dev environment, and on the Test server. but since we cannot reliably reproduce the problem, we may have to wait a while to see what happens... I got the mini-dumps for the crashes on prod; but since you've explained there is insufficient information I won't send the WinDbg analysis unless you indicate this would be helpful. BTW I am not a systems-developer, just an application-land developer; so my ability to use WinDbg and similar tools is a bit limited. I can follow any instructions if you send them. |
I downloaded the debug pack locally, unpacked, and added the unpacked-path to the Symbol Path in WinDbg. Is this right? attached is the result of "analysis -v" in WinDbg, using the debug pack does that provide additional information? If not please guide me how to use the debug pack - I'm sorry but I've never done it before... |
Yes, that should be correct. And at least it's better now:
So it crashes during a However, the stack backtrace still doesn't contain line numbers. Not sure why (I rarely use release builds with debug symbols when debugging). Let's see; maybe Jakub or Niels have an idea what might be wrong there. |
looking at the logs on our Test server from yesterday, I see this in the Opcache log:
and here's one of the application crashes, just seconds later:
the three files noted (models/Enrollments, SeatingChartController, /views/seatingChart/seatingChart) - are the files used by the single-page js app. the seatingChart php file launches the js code, which calls back to SeatingChartControllerto fetch/save the data. unclear if this is relevant but sharing so you have all possible info |
That looks like an OPcache corruption. |
Thanks for the new stack trace, it makes more sense now and that path is now quite clear. I was just checking again this flow and specifically this path and it still doesn't make any sense to me. It seems that it's crashing during release of either The only other thing that comes to my mind is that there is some other heap corruption going on. |
Just to add a bit more info. It happens during following calls
The |
Didn't deep dive into the logs yet, but since you mentioned |
Where do you see this? I didn't quite understand this sentence. I only see the code from RINIT that sets it to NULL; but I don't see a GINIT that sets it to NULL. |
If you add a
SO yeah, a path called from sapi_activate will access invalid memory most likely then. |
Yeah that doesn't look right and it actually omits cleaning the stat cache globals as well.
Ah I misread and thought that php_win32_core_globals_ctor is used but that's for php_win32_core_globals_id ... Yeah so I think we just need to properly ctor the basic global. Will create a PR for that. |
|
As usual, this issue is likely a combination of a few things |
Ah, |
@bukka The root cause of this issue is simply that the |
Hmm I'm not sure actually. The However it will be called later as well during the request startup. But as mentioned before, the |
Okay I see, so then it's a bit simpler |
@bukka and @nielsdos thank you very much for your rapid response to this bug report! I am very impressed 👍 I am quite ignorant of the PHP release-cycle process; and cannot find any information online about expected timeframe for 8.3.20, which I imagine would include this fix. can you set any expectation, or tell me where to find this info? also, just out of curiosity, was this problem caused by the fix for https://bugs.php.net/bug.php?id=72666, which was included in 8.3.19 ? |
Since PHP 8.3.20RC1 will be released today, it's unlikely that the fix will be included in 8.3.20. 8.3.21RC1 is to be expected in 4 weeks, 8.3.21 two weeks later. |
Sorry put it incorrectly to 8.3.20 NEWS but it will be in 8.3.21 as we have already RC1 for 8.3.20. So ti will get released on 8th May. Yes that fix from 8.3.19 caused the issue to happen even though the implementation was already incorrect - it just didn't result in any visible issue. |
For the record the NEWS fix is following: fe49306 |
Thanks all for the updates. I'm trying (without success) to isolate which part of our application code triggers this bug. It's quite inconsistent: the same action works multiple times, then fails. When it fails a) there is nothing in the apache access log; b) it never invokes the step-debugger; c) debug/trace logging in the application code never get output. Very difficult to figure out where it's failing. I reverted to PHP 8.3.18 on my local dev system; and the bug is still there. I don't have the skills/tools to build PHP myself. |
p.s. I analyzed another recent dump file, and the stack-trace continues a little past EDIT: this is on 8.3.18, not 8.3.19
|
I found this: https://github.com/shivammathur/php-builder-windows/releases/tag/php8.3 which appears to have builds of 8.3.21dev from within the past 14 hours, since the commit which fixed this bug. however that version still crashes on my system. see attached debug info EDIT: sorry for the multiple missing-symbol-path problems in the debug analysis. Scroll to the bottom to see the one with correct symbols. |
According to https://github.com/shivammathur/php-builder-windows/releases/download/php8.3/ts-windows-vs16-x64.json, the build does not yet contain the fix. I suggest to try with the next nighly builds. |
Done, and it seems to be fixed. thanks again everyone for your prompt response to this issue! |
Description
debug-analysis-1.txt
very sorry: I don't know how to reproduce this bug. but I can see the crash dump files on the web server.
using WinDbg I opened and analyzed one of the files. the analysis including stack-dump is in the attached txt file.
this is PHP 8.3.19 thread-safe running in Apache 2.4.63 on Windows Server 2019
PHP Version
PHP 8.3.19
Operating System
Windows Server 2019
The text was updated successfully, but these errors were encountered: