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: 2019-06-23 14:53 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: oleg at andreyev dot lv Assigned:
Status: Open Package: Built-in web server
PHP Version: 7.3Git-2019-06-22 (Git) OS: MacOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oleg at andreyev dot lv
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 09:01:23 2020 UTC