View Issue Details

IDProjectCategoryView StatusLast Update
0001346XdebugStacktracespublic2016-12-04 17:05
ReporterjohnhuntAssigned Toderick 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionno change required 
PlatformMacOSOS XOS Version10.11.6
Product Version2.4.0 
Target VersionFixed in Version 
Summary0001346: Segfault during handshake with phpstorm 10.0.3
DescriptionPHP and xdebug installed via homebrew:

homebrew/php/php71-xdebug
homebrew/php/php71

php --version:
PHP 7.1.0alpha2 (cli) (built: Jun 27 2016 22:39:02) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

Steps To ReproduceConfigure xdebug to connect to localhost PHPstorm:

cat /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini:
zend_extension="/usr/local/opt/php71-xdebug/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug_remote_server localhost
xdebug.remote_autostart = 1

Set phpstorm to listen. Then execute a simple script:
john@Johns-MacBook-Pro:/Volumes/projects/api/public (master)$ cat test.php
<?php
echo 'hello world';

john@Johns-MacBook-Pro:/Volumes/projects/api/public (master)$ php test.php
Segmentation fault: 11

boom!!

So I looked into this further. Instead of running phpstorm on port 9000 I ran netcat, and discovered that there are no crashes. So then I ran a stack trace and had a look at the traffic with wireshark. Turns out that Xdebug (or PHP) dies horribly during some kind of network 'handshake':

write(0x3, "504\0", 0x1FD) = 509 0 (the big 'hello' XML thing from xdebug)
recvfrom(0x3, 0x7FFF5A40FB00, 0x80) = 37 0
write(0x3, "218\0", 0xDF) = 223 0
recvfrom(0x3, 0x7FFF5A40FB00, 0x80) = 35 0
write(0x3, "216\0", 0xDD) = 221 0
recvfrom(0x3, 0x7FFF5A40FB00, 0x80) = 40 0
write(0x3, "219\0", 0xE0) = 224 0
recvfrom(0x3, 0x7FFF5A40FB00, 0x80) = 12 0
write(0x3, "209\0", 0xD6) = 214 0
recvfrom(0x3, 0x7FFF5A40FB00, 0x80) = 15 0

Most of the other requests I didn't recognise, and I forgot to save the dump. Some of them were showing the pointer to the line in the php file.
Additional InformationThe problem only occured with php7.1 and not the php 7.0 packages which I downgraded to.

It's probably something fairly simple, but I'm no C developer so not sure I can help any more than this. I just assumed I'd done something wrong hence all the digging.
TagsNo tags attached.
Operating SystemOS X
PHP Version7.1-dev

Activities

johnhunt

2016-09-08 09:58

reporter   ~0003698

Just noticed in the xdebug config:

xdebug_remote_server localhost

Was missing an = symbol.. unlikely that this was the cause but worth noting.

derick

2016-11-16 21:25

administrator   ~0003756

Instead of wireshark, could you install gdb, and run the PHP script with:

gdb --args php test.php

then on the gdb prompt:

run

and when it crashes:

bt full

And attach the output as a file here.

I would also suggest you upgrade or try out Xdebug 2.5.0RC1 first as well.

raheja.rohan

2016-11-25 11:54

reporter   ~0003792

I just tried the XDebug RC with php7-1 and PhpStorm. It's working well.

derick

2016-12-04 17:05

administrator   ~0003921

Perfect, let me close this then.

Issue History

Date Modified Username Field Change
2016-09-08 09:35 johnhunt New Issue
2016-09-08 09:58 johnhunt Note Added: 0003698
2016-11-16 21:25 derick Note Added: 0003756
2016-11-16 21:25 derick Assigned To => derick
2016-11-16 21:25 derick Status new => feedback
2016-11-25 11:54 raheja.rohan Note Added: 0003792
2016-12-04 17:05 derick Note Added: 0003921
2016-12-04 17:05 derick Status feedback => resolved
2016-12-04 17:05 derick Resolution open => no change required