View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001401 | Xdebug | Step Debugging | public | 2017-02-22 10:00 | 2020-01-27 19:33 |
Reporter | jaytaph | Assigned To | derick | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | osx | ||||
Summary | 0001401: XDebug does not check correctly for closed connections | ||||
Description | In the master branch there is a new check in send_message() that will print out a warning whenever SSENDL() cannot correctly send over all data. However, this does not check to see if the current socket is already closed or not, resulting in a lot of warnings that shouldn't. When remote_autostart & remote_connect_back are set (which is often the case when dealing with a development environment where you start the listener from the IDE like PHPStorm), normally, the 9000 port is closed, resulting in SYN packet from xdebug immediately followed by RST+ACK from osx since that port is not listening. XDebug does not detect this correctly, resulting in send_message() happily trying to send over data). As soon as the IDE debug listener is turned on, port 9000 is available and send_message() can send data without issues. | ||||
Steps To Reproduce | set configuration to:
Run any script. Turn on debugger on port 9000 | ||||
Tags | No tags attached. | ||||
Operating System | osx | ||||
PHP Version | 7.1.0-7.1.4 | ||||
|
Curious, I thought I had replied to this one already. I can not reproduce this. When I run this on Linux with strace, I just get this: socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 And nothing else — perhaps it is different on OSX. Can you make something like an strace for OSX? I think it's called dtruss there. |
|
I've taken a closer look and the setup is a bit more complicated than simply osx (because docker). I've managed to track the issue down to automatically connecting to an incorrect IP address, which turns out is the same IP address where a php-fpm instance is running on port 9000. This apparently does not like to chat with dbgp, since php-fpm drops the connection after the initial xml packet, but this isn't picked up by xdebug. This is a backtrace of what's happening, with some small remarks [pid 9] <... accept resumed> {sa_family=AF_INET6, sin6_port=htons(56418), inet_pton(AF_INET6, "::ffff:172.18.0.13", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 5 opening Xdebug connection to 172.18.0.3:9000 (which runs php-fpm, not an xdebug listener)[pid 9] socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 7 php-fpm closes connection[pid 9] recvfrom(7, 0x7ffffd998cb0, 128, 0, 0, 0) = -1 ECONNRESET (Connection reset by peer) xdebug didn't handle closed connection and happily sends more data[pid 9] write(7, "173\0<?xml version=\"1.0\" encoding"..., 178) = -1 EPIPE (Broken pipe) [pid 9] fcntl(4, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 |
|
I'll improve the error message, but it's working as expected: Xdebug can't detect that a connection has been closed until it tries to write again. And when it tries to write, the write fails and Xdebug shows an error message. In this case, the error message rightfully pointed out that something was wrong. |
|
Improved the error message for 2.6dev. |
|
I noticed this happens in a specific instance for me. When phpstorm either has too many debug connections open or the connection has timed out. Closing php storm resolved the issue for me. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-02-22 10:00 | jaytaph | New Issue | |
2017-02-28 16:54 | derick | Note Added: 0004221 | |
2017-02-28 16:54 | derick | Assigned To | => derick |
2017-02-28 16:54 | derick | Status | new => feedback |
2017-03-01 10:53 | jaytaph | Note Added: 0004222 | |
2017-03-01 10:53 | jaytaph | Status | feedback => assigned |
2017-03-01 12:26 | derick | Note Added: 0004223 | |
2017-03-02 09:59 | derick | Note Added: 0004225 | |
2017-03-02 09:59 | derick | Status | assigned => closed |
2017-03-02 09:59 | derick | Resolution | open => fixed |
2020-01-27 19:33 | vortextangent | Note Added: 0005226 | |
2020-03-12 16:33 | derick | Category | Remote Debugging => Step Debugging |