View Issue Details

IDProjectCategoryView StatusLast Update
0002216XdebugUncategorizedpublic2024-03-29 09:45
Reporterkieranfj Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindowsOS Version11/10
Product Version3.3.0alpha3 
Fixed in Version3.3dev 
Summary0002216: With PHP8.3 and Apache 2.4.58 error_reporting() causing Apache process to hang
Description

Whe running the script multiple times in quick succession, the Apache process hangs and increases CPU usage every time the script is run
Process doesnt end and subsequent requests never returned
Turning off xdebug an Apache/PHP works as normal.

Happens regardless of php.ini error_reporting setting (whether its changed from the default or not)

Steps To Reproduce

Run script once via browser request - Apache responds as normal
Run script multiple times in quick succession (Hammer refresh 4/5 times quickly) CPU usage of apache process rises and subsequent requests dont return.

Disable xdebug (comment out the .dll or just turn it off) Apache responds as normal

Additional Information

Tried on two windows machines, a 10 and 11

Wampserver package (3.3.2, Apahce 2.4.58, PHP 8.3.0) being used
xdebug 3.3.0alpha3

TagsNo tags attached.
Attached Files
phpinisettings.txt (156 bytes)   
xdebug.mode = develop,debug
;xdebug.mode = off
;xdebug.log_level=0

expose_php = Off



;error_reporting E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED
phpinisettings.txt (156 bytes)   
xdebug.log (5,516 bytes)   
--- File cleaned up by Wampserver ---
--- on 2023-11-28 09:06
[29608] Log closed at 2023-11-28 09:06:59.957190

[14176] Log opened at 2023-11-28 09:07:00.009805
[14176] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[14176] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[14176] Log closed at 2023-11-28 09:07:01.334464

[476] Log opened at 2023-11-28 09:07:18.151201
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[30748] Log opened at 2023-11-28 09:07:18.422583
[30748] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[30748] [Config] INFO: No shared secret: Activating
[30748] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:18.556349

[476] Log opened at 2023-11-28 09:07:18.674514
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[30748] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[30904] Log opened at 2023-11-28 09:07:18.945141
[30904] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[30904] [Config] INFO: No shared secret: Activating
[30904] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:19.086892

[476] Log opened at 2023-11-28 09:07:19.217513
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[30904] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[6064] Log opened at 2023-11-28 09:07:19.502093
[6064] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[6064] [Config] INFO: No shared secret: Activating
[6064] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:19.632989

[476] Log opened at 2023-11-28 09:07:19.780898
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[6064] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[13068] Log opened at 2023-11-28 09:07:20.071560
[13068] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[13068] [Config] INFO: No shared secret: Activating
[13068] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:20.200531

[476] Log opened at 2023-11-28 09:07:20.352985
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[13068] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[1084] Log opened at 2023-11-28 09:07:20.635260
[1084] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[1084] [Config] INFO: No shared secret: Activating
[1084] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:20.758954

[476] Log opened at 2023-11-28 09:07:20.917618
[476] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[476] [Config] INFO: No shared secret: Activating
[476] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[1084] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[476] Log closed at 2023-11-28 09:07:21.328974

xdebug.log (5,516 bytes)   
xdebugtest.php (96 bytes)   
<?php

error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED);

echo "test";
die();
xdebugtest.php (96 bytes)   
Operating SystemWindows
PHP Version8.2.0-8.2.9

Relationships

has duplicate 0002233 resolvedderick High and continuous Apache server CPU use 

Activities

soulflyman

2023-12-04 15:55

reporter   ~0006701

Nearly identical problem on my system when using Apache 2.4.58 + php 8.3 + xdebug 3.3.0_8.3 does freeze my Apache process. In my case, the CPU usage does not go up, it just freezes.

Running Apache 2.4.58 + php 8.2 + xdebug 3.3.0_8.2 works without any problems.

Are there any logs I can provide to help diagnose this problem?

Neil

2023-12-12 23:05

reporter   ~0006726

I'm having the same issue with php hanging when running Wampserver 3.3.3 with Apache 2.4.58 + php 8.3 + php_xdebug-3.3.0-8.3-vs16-x86_64.dll while php_xdebug-3.3.0-8.2-vs16-x86_64.dll is working fine on php 8.2

Setting xdebug.mode=off fixes the handing issue.

Happy to provide any relevant logs.

derick

2023-12-15 12:26

administrator   ~0006730

I have released Xdebug 3.3.1, in which I believe these issues are fixed. Could you all please try that version?

Neil

2023-12-15 20:37

reporter   ~0006732

Unfortunately Xdebug 3.3.1 didn’t fix the issue for me when using xdebug.mode = develop,debug I also checked the following modes individually and get the same issue

xdebug.mode = develop
xdebug.mode = debug
xdebug.mode = trace

When browsing the site normally everything seems fine however when running Playwright tests once specific set of pages handled by one php file consistently triggers the hanging behaviour normally on page 5 of the tested pages. It seems the speed the pages are accessed is a factor.

I will investigate further and try and put together a php file that triggers the issue that I can share.

If there are any xdebug configurations I can use to log what’s going on please let me know.

kieranfj

2023-12-15 20:49

reporter   ~0006733

Installed xdebug 3.3.1 and can also confirm the hanging behaviour is still present

Apache 2.4.58
PHP 8.3.0
xDebug 3.3.1 (also previously tried the full 3.3.0 non-alpha version)

Neil

2023-12-16 10:52

reporter   ~0006734

Ok, I’ve attached the smallest amount of code that causes the page to hang normally on the second refresh, if you don’t see the issue try refreshing with chrome dev tools open (F12) with the “Disable cache” setting ticked on the “Network tab”

The issues goes away if I comment out error_reporting(0); or disable to RewriteRule in the .htaccess file or there is only one image on the page.

Let me know if you are not able to reproduce the issue I’m seeing with the attached code, and I can send php.ini and httpd.conf in case there is some that is different from your test environment.

See this video of the page loading normally with error_reporting(0); commented out and then hanging once error_reporting(0); is uncommented.

https://www.dropbox.com/scl/fi/fzhythftrv04jybawdztj/xdebug_hang.mp4?rlkey=h6twyjhhyaf6h4tweyfndutdt&amp;dl=0

xdebug_hang_test.zip (7,471 bytes)

Neil

2023-12-16 10:58

reporter   ~0006735

The video link I post was modified by the form, to view it you will need to replace & with & at the end of the url

derick

2023-12-21 10:22

administrator   ~0006738

I'll have a look after the break.

macgritsch

2024-01-02 17:31

reporter   ~0006745

I can confirm this issue.
Even with version 3.3.1

derick

2024-01-09 12:05

administrator   ~0006757

Can any of you report this on Linux?

Neil

2024-01-09 13:18

reporter   ~0006759

Last edited: 2024-01-10 18:26

I checked my test case in a docker container (based on debian 12) with the following config and there was no issues so I’m assuming the issue is specific to PHP on windows.

========= Dockerfile_custom start =========

FROM php:8.3-apache

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    libzip-dev \
    zip \
    && docker-php-ext-install zip

# Enable Apache mod_rewrite
RUN a2enmod rewrite

# Install Xdebug
RUN pecl install xdebug \
    && docker-php-ext-enable xdebug

EXPOSE 80

========= Dockerfile_custom end =========

========= docker-compose.yml start =========

version: '3.8'

services:
  web:
    build:
        context: .
        dockerfile: Dockerfile_custom
    ports:
        - &quot;80:80&quot;
    volumes:
        - C:\docker_www:/var/www/html
        - ./config/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    stdin_open: true
    tty: true
    restart: &quot;no&quot;

========= docker-compose.yml end =========

========= xdebug.ini start =========

zend_extension=xdebug
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.mode = debug,develop

========= xdebug.ini end =========

xdebug_info(); was used to confirm xdebug was active and the version was 3.3.1

macgritsch

2024-01-09 14:18

reporter   ~0006760

Last edited: 2024-01-10 18:27

I can also not reproduce it on macOS.

test.php:

&lt;?
    error_reporting(0);

    sleep(1);

    echo &quot;SUCCESS\n&quot;;
?>

call in terminal:

for i in {1..100}; do curl &quot;http://host/test.php&quot; &; done

derick

2024-01-10 18:28

administrator   ~0006762

I doubt this would reproduce on the CLI with concurrent requests, there is something that happens in a threaded environment I suspect. This is probably also why your Apache/Linux run didn't work. By default it still uses mpm_prefork, and not mpm_worker, I believe.

FWIW, I have no Windows to test this on.

Neil

2024-01-12 02:35

reporter   ~0006771

I checked and the docker container I used above and it uses mpm_prefork with mod_php (Server API: Apache 2.0 Handler)

I did some further testing on windows and the following code only hangs when using mod_php (Server API: Apache 2.0 Handler) but works fine when using mod_fcgid (Server API: CGI/FastCGI)

error_reporting(0);
sleep(1);
echo &quot;SUCCESS&quot;;

hiroko

2024-02-11 10:01

reporter   ~0006846

Something not mentioned before:
The issue doesn't happen if the error reporting level is set with the ini_set function.
ini_set('error_reporting', 0);
(Doesn't matter what the value of the second argument is.)

gponty

2024-02-21 09:52

reporter   ~0006850

same thing here with FrankenPHP (Caddy)

Francexi

2024-02-25 11:16

reporter   ~0006855

i can report this happening also on Slackware current.

Description

The following code:

&lt;?php error_reporting(-1); ?>

Seems to randomly hang when called from the line BasicErrorHandler.php:23 of Symfony. I'm running it on a Apache web server. When checking the server status, the process linked to the request is hanged in "W" status (sending response) and the browser received no byte from the server.

I run pstack on the process that is handling the request, obtaining the following trace: https://pastebin.com/iNxBiEtn.

The part that seems interesting is:

* 9  Thread 0x7fac137fe6c0 (LWP 18791) &quot;httpd&quot; 0x00007fac25f08700 in tsrm_get_ls_cache () from /usr/lib64/httpd/modules/libphp.so
#0  0x00007fac25f08700 in tsrm_get_ls_cache () from /usr/lib64/httpd/modules/libphp.so
#1  0x00007fac26b31e3d in zif_xdebug_error_reporting () from /usr/lib64/php/extensions/xdebug.so
0000002  0x00007fac25d523ca in ?? () from /usr/lib64/httpd/modules/libphp.so
0000003  0x00007fac25d52cc4 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000004  0x00007fac25d52303 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000005  0x00007fac25d52cc4 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000006  0x00007fac25d52303 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000007  0x00007fac25d52cc4 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000008  0x00007fac25d52303 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000009  0x00007fac25d52cc4 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000010 0x00007fac25d52303 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000011 0x00007fac25d52cc4 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000012 0x00007fac25fb77ce in ?? () from /usr/lib64/httpd/modules/libphp.so
0000013 0x00007fac25fdf8f1 in execute_ex () from /usr/lib64/httpd/modules/libphp.so
0000014 0x00007fac25fe9439 in zend_execute () from /usr/lib64/httpd/modules/libphp.so
0000015 0x00007fac25f77196 in zend_execute_scripts () from /usr/lib64/httpd/modules/libphp.so
0000016 0x00007fac25f0ba95 in php_execute_script () from /usr/lib64/httpd/modules/libphp.so
0000017 0x00007fac2605e268 in ?? () from /usr/lib64/httpd/modules/libphp.so
0000018 0x000055782b451bf0 in ap_run_handler ()
0000019 0x000055782b4521d6 in ap_invoke_handler ()
0000020 0x000055782b4674be in ap_internal_redirect ()
0000021 0x00007fac29710134 in ?? () from /usr/lib64/httpd/modules/mod_rewrite.so
0000022 0x000055782b451bf0 in ap_run_handler ()
0000023 0x000055782b4521d6 in ap_invoke_handler ()
0000024 0x000055782b4674be in ap_internal_redirect ()
0000025 0x00007fac29710134 in ?? () from /usr/lib64/httpd/modules/mod_rewrite.so
0000026 0x000055782b451bf0 in ap_run_handler ()
0000027 0x000055782b4521d6 in ap_invoke_handler ()
0000028 0x000055782b468057 in ap_process_async_request ()
0000029 0x000055782b46454c in ?? ()
0000030 0x000055782b45b1f0 in ap_run_process_connection ()
0000031 0x00007fac2a1a9776 in ?? () from /usr/lib64/httpd/modules/mod_mpm_event.so
0000032 0x00007fac2a1aa172 in ?? () from /usr/lib64/httpd/modules/mod_mpm_event.so
0000033 0x00007fac29e94d57 in start_thread () from /lib64/libc.so.6
0000034 0x00007fac29f196a8 in clone3 () from /lib64/libc.so.6

The hang happens not for all the call to the same file, but always at the same line. With XDebug disabled it seems to not happen

I'll monitor this thread if you need any more informations

PHP Version

8.3.3

Operating System

Slackware-current

Francexi

2024-02-25 16:26

reporter   ~0006856

Adding to the one before: downgrading to 8.2.13 without changing any configuration or downgrading Xdebug, makes the problem not happen

dunglas

2024-03-20 10:41

reporter   ~0006863

For the record, I created a minimal reproducer that isn't using Docker: https://github.com/dunglas/frankenphp/issues/563#issuecomment-2009244388
This is likely the same bug.

derick

2024-03-28 16:53

administrator   ~0006870

https://github.com/xdebug/xdebug/pull/958

Neil

2024-03-29 01:04

reporter   ~0006875

Is there a compiled windows version of the dll for PHP 8.3 VS16 TS (64 bit) with the patch to check if the crash has been fixed on windows.

Neil

2024-03-29 04:55

reporter   ~0006876

Just to report back, I compiled the 3.3.2-dev release from dunglas:fix/overloaded_functions_zts and the issues I reported in this thread seem to be fixed now.

derick

2024-03-29 08:02

administrator   ~0006878

You can use the artefacts from https://github.com/xdebug/xdebug/actions/runs/8470808863#artifacts

I'll remove your attached dlls, as I can't verify where they came from.

Vincent T

2024-03-29 09:20

reporter   ~0006879

Just downloaded php_xdebug-3.3.2-dev-8.2-vs16-x86_64.dll and noticed that phpinfo displays "with Xdebug v3.3.2-dev, Copyright (c) 2002-2023, by Derick Rethans".
Shouldn't it be "2024" ?

derick

2024-03-29 09:45

administrator   ~0006880

No worries Vincent, I'll update that when I make a release.

Issue History

Date Modified Username Field Change
2023-11-28 09:17 kieranfj New Issue
2023-11-28 09:17 kieranfj File Added: phpinisettings.txt
2023-11-28 09:17 kieranfj File Added: Screenshot 2023-11-28 085400.png
2023-11-28 09:17 kieranfj File Added: xdebug.log
2023-11-28 09:17 kieranfj File Added: xdebugtest.php
2023-12-04 15:55 soulflyman Note Added: 0006701
2023-12-12 23:05 Neil Note Added: 0006726
2023-12-15 12:26 derick Note Added: 0006730
2023-12-15 20:37 Neil Note Added: 0006732
2023-12-15 20:49 kieranfj Note Added: 0006733
2023-12-16 10:52 Neil Note Added: 0006734
2023-12-16 10:52 Neil File Added: xdebug_hang_test.zip
2023-12-16 10:58 Neil Note Added: 0006735
2023-12-21 10:22 derick Assigned To => derick
2023-12-21 10:22 derick Status new => acknowledged
2023-12-21 10:22 derick Note Added: 0006738
2024-01-02 17:31 macgritsch Note Added: 0006745
2024-01-09 12:05 derick Note Added: 0006757
2024-01-09 13:18 Neil Note Added: 0006759
2024-01-09 14:18 macgritsch Note Added: 0006760
2024-01-10 18:26 derick Note Edited: 0006759
2024-01-10 18:27 derick Note Edited: 0006760
2024-01-10 18:28 derick Note Added: 0006762
2024-01-12 02:35 Neil Note Added: 0006771
2024-02-11 10:01 hiroko Note Added: 0006846
2024-02-21 09:52 gponty Note Added: 0006850
2024-02-25 11:16 Francexi Note Added: 0006855
2024-02-25 16:26 Francexi Note Added: 0006856
2024-03-20 10:41 dunglas Note Added: 0006863
2024-03-28 16:53 derick Status acknowledged => closed
2024-03-28 16:53 derick Resolution open => fixed
2024-03-28 16:53 derick Fixed in Version => 3.3dev
2024-03-28 16:53 derick Note Added: 0006870
2024-03-28 16:55 derick Relationship added has duplicate 0002233
2024-03-29 01:04 Neil Note Added: 0006875
2024-03-29 04:55 Neil Note Added: 0006876
2024-03-29 08:02 derick Note Added: 0006878
2024-03-29 08:02 derick File Deleted: php_xdebug-3.3.2-dev-8.3-vs16-x86_64.dll
2024-03-29 09:20 Vincent T Note Added: 0006879
2024-03-29 09:45 derick Note Added: 0006880