php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78198 segmentation fault php build-in server 7.3.2
Submitted: 2019-06-22 21:36 UTC Modified: 2021-08-08 04:22 UTC
Votes:2
Avg. Score:3.5 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: oleg at andreyev dot lv Assigned: cmb (profile)
Status: No Feedback Package: Built-in web server
PHP Version: 7.3Git-2019-06-22 (Git) OS: MacOS
Private report: No CVE-ID: None
 [2019-06-22 21:36 UTC] oleg at andreyev dot lv
Description:
------------
Running php 7.3.2 build-in servers and getting segmentation fault

lldb

```
➜  MinkSelenium2Driver lldb -d -p 42319
(lldb) process attach --pid 42319
Process 42319 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff6be1161a libsystem_kernel.dylib`__select + 10
libsystem_kernel.dylib`__select:
->  0x7fff6be1161a <+10>: jae    0x7fff6be11624            ; <+20>
    0x7fff6be1161c <+12>: movq   %rax, %rdi
    0x7fff6be1161f <+15>: jmp    0x7fff6be0a421            ; cerror
    0x7fff6be11624 <+20>: retq   
Target 0: (php) stopped.

Executable module set to "/Users/oandreyev/.phpenv/versions/7.3.2/bin/php".
Architecture set to: x86_64h-apple-macosx-.
(lldb) continue
Process 42319 resuming
Process 42319 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x196e33e88)
    frame #0: 0x0000000105ac34ed php`timelib_get_time_zone_info + 221
php`timelib_get_time_zone_info:
->  0x105ac34ed <+221>: cmpq   %rbx, (%rsi,%rax)
    0x105ac34f1 <+225>: jge    0x105ac34e0               ; <+208>
    0x105ac34f3 <+227>: xorl   %ecx, %ecx
    0x105ac34f5 <+229>: subl   0x8(%rsi,%rax), %ecx
Target 0: (php) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x196e33e88)
  * frame #0: 0x0000000105ac34ed php`timelib_get_time_zone_info + 221
    frame #1: 0x0000000105a9e015 php`date_format + 389
    frame #2: 0x0000000105a9de68 php`php_format_date + 200
    frame #3: 0x000000010609dc9b php`append_essential_headers + 347
    frame #4: 0x000000010609e9d8 php`php_cli_server_recv_event_read_request + 1560
    frame #5: 0x000000010609f19e php`php_cli_server_do_event_for_each_fd_callback + 158
    frame #6: 0x000000010609d24e php`do_cli_server + 2254
    frame #7: 0x0000000106097882 php`main + 1122
    frame #8: 0x00007fff6bcd53d5 libdyld.dylib`start + 1
    frame #9: 0x00007fff6bcd53d5 libdyld.dylib`start + 1
(lldb) BB

```

Test script:
---------------
https://gist.github.com/oleg-andreyev/8d809dea15dcb7becdc3a45cff2c3841

Expected result:
----------------
build-in server should not fail with segmentation fault


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-23 14:53 UTC] cmb@php.net
-Package: *Web Server problem +Package: Built-in web server
 [2019-07-20 15:04 UTC] welkom at webist dot nl
Solved for my personal use on MacOS, PHP 7.3.7 that comes with brew, by setting `output_buffering = Off` in php.ini file.

Requests from Firefox browser do not cause the problem, however Chrome based browser, I am using Brave, cause following Apache error log `[core:notice] [pid 1511] AH00052: child pid <..> exit signal Segmentation fault (11)` 

It should be noticed that in every PHP 7 sub version there seem to be similar type of errors were fixed.

There are different memory allocation policies on different OS's. For example MacOS allows very limited space for Shared Memory while Ubuntu allows a huge number, essentially unlimited. MacOS also do not allow to cleanup segments that was created by the original user. So the function `shmop_delete` works same on both MacOS and ubuntu?
On MacOS I am, as sudo user, using manually the following command to clean up memory.
"ipcs -ma | awk '/^m / { if ($9 == 0) { print $2 }}' | xargs -n 1 ipcrm -m > /dev/null 2>/dev/null &" 
Which implies Shared memory on MacOS is essentially unusable.
 [2021-07-28 15:25 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-28 15:25 UTC] cmb@php.net
Is that still an issue for you with any of the actively supported
PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-08-08 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 22:01:27 2024 UTC