martomo / SublimeTextXdebug

Xdebug debugger client for Sublime Text
MIT License
564 stars 89 forks source link

Connection lost after end of code #155

Open hollusion opened 8 years ago

hollusion commented 8 years ago
  1. set breakpoint
  2. append &XDEBUG_SESSION_START=sublime.xdebug to url
  3. debug until end of code
  4. visit another link that would reach the same breakpoint => nothing happens
  5. set or unset another breakpoint and get the following message
error: Please restart Xdebug debugging session.
Disconnected from Xdebug debugger engine.
[Errno 32] Broken pipe

The only way to debug again ist to stop and start the session in sublime and visit an url with &XDEBUG_SESSION_START=sublime.xdebug appended. It is really annoying and not usable to debug ajax requests. Please help!

xdebug log:

Log opened at 2015-11-09 14:55:54
I: Checking remote connect back address.
I: Remote address found, connecting to 127.0.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/wi/User.php" language="PHP" protocol_version="1.0" appid="6832" idekey="sublime.xdebug"><engine version="2.2.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_children -v 32
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_children" success="1"></response>

<- feature_set -i 3 -n max_data -v 1024
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_data" success="1"></response>

<- feature_set -i 4 -n max_depth -v 2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_depth" success="1"></response>

<- breakpoint_set -i 5 -f file%3A///var/www/wi/User.php -t line -n 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="68320009"></response>

<- run -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file:///var/www/wi/User.php" lineno="3"></xdebug:message></response>

<- eval -i 7 -- JHJ1bGVz
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="7"><property address="140736551915152" type="null"></property></response>

<- eval -i 8 -- JGNoZWNrcw==
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="8"><property address="140736551915152" type="null"></property></response>

<- context_get -i 9 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="9" context="1"><property name="$_COOKIE" fullname="$_COOKIE" address="140196790856960" type="array" children="1" numchildren="3" page="0" pagesize="32"><property name="PHPSESSID" fullname="$_COOKIE[&#39;PHPSESSID&#39;]" address="140196790857648" type="string" size="26" encoding="base64"><![CDATA[bmxiYzl2MWVkbDBxZHViZ2hybXIzYWg2ZTc=]]></property><property name="acceleratedUseTreeView" fullname="$_COOKIE[&#39;acceleratedUseTreeView&#39;]" address="140196790858024" type="string" size="4" encoding="base64"><![CDATA[dHJ1ZQ==]]></property><property name="XDEBUG_SESSION" fullname="$_COOKIE[&#39;XDEBUG_SESSION&#39;]" address="140196790858400" type="string" size="14" encoding="base64"><![CDATA[c3VibGltZS54ZGVidWc=]]></property></property><property name="$_ENV" fullname="$_ENV" address="140196790858864" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_FILES" fullname="$_FILES" address="140196790858640" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_GET" fullname="$_GET" address="140196790854456" type="array" children="1" numchildren="3" page="0" pagesize="32"><property name="action" fullname="$_GET[&#39;action&#39;]" address="140196790855160" type="string" size="8" encoding="base64"><![CDATA[ZWRpdFVzZXI=]]></property><property name="id" fullname="$_GET[&#39;id&#39;]" address="140196790855592" type="string" size="2" encoding="base64"><![CDATA[NDU=]]></property><property name="XDEBUG_SESSION_START" fullname="$_GET[&#39;XDEBUG_SESSION_START&#39;]" address="140196790855960" type="string" size="14" encoding="base64"><![CDATA[c3VibGltZS54ZGVidWc=]]></property></property><property name="$_POST" fullname="$_POST" address="140196790856736" type="array" children="0" numchildren="0" page="0" pagesize="32"></property><property name="$_REQUEST" fullname="$_REQUEST" address="140196790859088" type="array" children="1" numchildren="3" page="0" pagesize="32"><property name="action" fullname="$_REQUEST[&#39;action&#39;]" address="140196790855160" type="string" size="8" encoding="base64"><![CDATA[ZWRpdFVzZXI=]]></property><property name="id" fullname="$_REQUEST[&#39;id&#39;]" address="140196790855592" type="string" size="2" encoding="base64"><![CDATA[NDU=]]></property><property name="XDEBUG_SESSION_START" fullname="$_REQUEST[&#39;XDEBUG_SESSION_START&#39;]" address="140196790855960" type="string" size="14" encoding="base64"><![CDATA[c3VibGltZS54ZGVidWc=]]></property></property><property name="$_SERVER" fullname="$_SERVER" address="140196790859696" type="array" children="1" numchildren="31" page="0" pagesize="32"><property name="HTTP_HOST" fullname="$_SERVER[&#39;HTTP_HOST&#39;]" address="140196790860264" type="string" size="2" encoding="base64"><![CDATA[d2k=]]></property><property name="HTTP_USER_AGENT" fullname="$_SERVER[&#39;HTTP_USER_AGENT&#39;]" address="140196790860840" type="string" size="76" encoding="base64"><![CDATA[TW96aWxsYS81LjAgKFgxMTsgVWJ1bnR1OyBMaW51eCB4ODZfNjQ7IHJ2OjQxLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNDEuMA==]]></property><property name="HTTP_ACCEPT" fullname="$_SERVER[&#39;HTTP_ACCEPT&#39;]" address="140196790861304" type="string" size="63" encoding="base64"><![CDATA[dGV4dC9odG1sLGFwcGxpY2F0aW9uL3hodG1sK3htbCxhcHBsaWNhdGlvbi94bWw7cT0wLjksKi8qO3E9MC44]]></property><property name="HTTP_ACCEPT_LANGUAGE" fullname="$_SERVER[&#39;HTTP_ACCEPT_LANGUAGE&#39;]" address="140196790861680" type="string" size="14" encoding="base64"><![CDATA[ZW4tVVMsZW47cT0wLjU=]]></property><property name="HTTP_ACCEPT_ENCODING" fullname="$_SERVER[&#39;HTTP_ACCEPT_ENCODING&#39;]" address="140196790862064" type="string" size="13" encoding="base64"><![CDATA[Z3ppcCwgZGVmbGF0ZQ==]]></property><property name="HTTP_REFERER" fullname="$_SERVER[&#39;HTTP_REFERER&#39;]" address="140196790862568" type="string" size="76" encoding="base64"><![CDATA[aHR0cDovL3dpL1VzZXIucGhwP2FjdGlvbj1lZGl0VXNlciZpZD00NSZYREVCVUdfU0VTU0lPTl9TVEFSVD1zdWJsaW1lLnhkZWJ1Zw==]]></property><property name="HTTP_COOKIE" fullname="$_SERVER[&#39;HTTP_COOKIE&#39;]" address="140196790862992" type="string" size="96" encoding="base64"><![CDATA[UEhQU0VTU0lEPW5sYmM5djFlZGwwcWR1Ymdocm1yM2FoNmU3OyBhY2NlbGVyYXRlZFVzZVRyZWVWaWV3PXRydWU7IFhERUJVR19TRVNTSU9OPXN1YmxpbWUueGRlYnVn]]></property><property name="HTTP_CONNECTION" fullname="$_SERVER[&#39;HTTP_CONNECTION&#39;]" address="140196790863360" type="string" size="10" encoding="base64"><![CDATA[a2VlcC1hbGl2ZQ==]]></property><property name="PATH" fullname="$_SERVER[&#39;PATH&#39;]" address="140196790863880" type="string" size="60" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmlu]]></property><property name="SERVER_SIGNATURE" fullname="$_SERVER[&#39;SERVER_SIGNATURE&#39;]" address="140196790864392" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="SERVER_SOFTWARE" fullname="$_SERVER[&#39;SERVER_SOFTWARE&#39;]" address="140196790864768" type="string" size="6" encoding="base64"><![CDATA[QXBhY2hl]]></property><property name="SERVER_NAME" fullname="$_SERVER[&#39;SERVER_NAME&#39;]" address="140196790865136" type="string" size="2" encoding="base64"><![CDATA[d2k=]]></property><property name="SERVER_ADDR" fullname="$_SERVER[&#39;SERVER_ADDR&#39;]" address="140196790865504" type="string" size="9" encoding="base64"><![CDATA[MTI3LjAuMC4x]]></property><property name="SERVER_PORT" fullname="$_SERVER[&#39;SERVER_PORT&#39;]" address="140196790865872" type="string" size="2" encoding="base64"><![CDATA[ODA=]]></property><property name="REMOTE_ADDR" fullname="$_SERVER[&#39;REMOTE_ADDR&#39;]" address="140196790866240" type="string" size="9" encoding="base64"><![CDATA[MTI3LjAuMC4x]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER[&#39;DOCUMENT_ROOT&#39;]" address="140196790866608" type="string" size="11" encoding="base64"><![CDATA[L3Zhci93d3cvd2k=]]></property><property name="REQUEST_SCHEME" fullname="$_SERVER[&#39;REQUEST_SCHEME&#39;]" address="140196790867248" type="string" size="4" encoding="base64"><![CDATA[aHR0cA==]]></property><property name="CONTEXT_PREFIX" fullname="$_SERVER[&#39;CONTEXT_PREFIX&#39;]" address="140196790867888" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="CONTEXT_DOCUMENT_ROOT" fullname="$_SERVER[&#39;CONTEXT_DOCUMENT_ROOT&#39;]" address="140196790868264" type="string" size="11" encoding="base64"><![CDATA[L3Zhci93d3cvd2k=]]></property><property name="SERVER_ADMIN" fullname="$_SERVER[&#39;SERVER_ADMIN&#39;]" address="140196790868656" type="string" size="22" encoding="base64"><![CDATA[d2VibWFzdGVyQHdpLmxvY2FsaG9zdA==]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER[&#39;SCRIPT_FILENAME&#39;]" address="140196790869040" type="string" size="20" encoding="base64"><![CDATA[L3Zhci93d3cvd2kvVXNlci5waHA=]]></property><property name="REMOTE_PORT" fullname="$_SERVER[&#39;REMOTE_PORT&#39;]" address="140196790869408" type="string" size="5" encoding="base64"><![CDATA[NDAzNjg=]]></property><property name="GATEWAY_INTERFACE" fullname="$_SERVER[&#39;GATEWAY_INTERFACE&#39;]" address="140196790869784" type="string" size="7" encoding="base64"><![CDATA[Q0dJLzEuMQ==]]></property><property name="SERVER_PROTOCOL" fullname="$_SERVER[&#39;SERVER_PROTOCOL&#39;]" address="140196790870160" type="string" size="8" encoding="base64"><![CDATA[SFRUUC8xLjE=]]></property><property name="REQUEST_METHOD" fullname="$_SERVER[&#39;REQUEST_METHOD&#39;]" address="140196790870528" type="string" size="3" encoding="base64"><![CDATA[R0VU]]></property><property name="QUERY_STRING" fullname="$_SERVER[&#39;QUERY_STRING&#39;]" address="140196790870912" type="string" size="57" encoding="base64"><![CDATA[YWN0aW9uPWVkaXRVc2VyJmlkPTQ1JlhERUJVR19TRVNTSU9OX1NUQVJUPXN1YmxpbWUueGRlYnVn]]></property><property name="REQUEST_URI" fullname="$_SERVER[&#39;REQUEST_URI&#39;]" address="140196790871392" type="string" size="67" encoding="base64"><![CDATA[L1VzZXIucGhwP2FjdGlvbj1lZGl0VXNlciZpZD00NSZYREVCVUdfU0VTU0lPTl9TVEFSVD1zdWJsaW1lLnhkZWJ1Zw==]]></property><property name="SCRIPT_NAME" fullname="$_SERVER[&#39;SCRIPT_NAME&#39;]" address="140196790871760" type="string" size="9" encoding="base64"><![CDATA[L1VzZXIucGhw]]></property><property name="PHP_SELF" fullname="$_SERVER[&#39;PHP_SELF&#39;]" address="140196790872128" type="string" size="9" encoding="base64"><![CDATA[L1VzZXIucGhw]]></property><property name="REQUEST_TIME_FLOAT" fullname="$_SERVER[&#39;REQUEST_TIME_FLOAT&#39;]" address="140196790872280" type="float"><![CDATA[1447080954.426]]></property><property name="REQUEST_TIME" fullname="$_SERVER[&#39;REQUEST_TIME&#39;]" address="140196790872440" type="int"><![CDATA[1447080954]]></property></property></response>

<- context_get -i 10
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="10" context="0"><property name="$a" fullname="$a" type="uninitialized"></property><property name="$action" fullname="$action" type="uninitialized"></property><property name="$num" fullname="$num" type="uninitialized"></property><property name="$r" fullname="$r" type="uninitialized"></property><property name="$return" fullname="$return" type="uninitialized"></property><property name="$u" fullname="$u" type="uninitialized"></property><property name="$user" fullname="$user" type="uninitialized"></property></response>

<- stack_get -i 11
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="11"><stack where="{main}" level="0" type="file" filename="file:///var/www/wi/User.php" lineno="3"></stack></response>

<- eval -i 12 -- JHJ1bGVz
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property address="140736551915152" type="null"></property></response>

<- eval -i 13 -- JGNoZWNrcw==
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property address="140736551915152" type="null"></property></response>

<- step_out -i 14
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_out" transaction_id="14" status="stopping" reason="ok"></response>

<- eval -i 15 -- JHJ1bGVz
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="15"><error code="5"><message><![CDATA[command is not available]]></message></error></response>

Log closed at 2015-11-09 14:56:18

Log opened at 2015-11-09 14:56:21
I: Checking remote connect back address.
I: Remote address found, connecting to 127.0.0.1:9000.
E: Could not connect to client. :-(
Log closed at 2015-11-09 14:56:21

xdebug settings:

zend_extension=xdebug.so

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log="/var/www/wi.xdebug.log"
xdebug.remote_mode=req
xdebug.remote_connect_back=1
xdebug.remote_autostart=true
floleg commented 8 years ago

Hi, I'm getting the same isssue, running Sublime Text 2 on Ubuntu 14.04. Did you find a way to fix this?

Thank you.

slifin commented 8 years ago

I'm getting the same issue on ST3 and ubuntu 16.04

tchalvak commented 8 years ago

Same issue here, I think the server<-->client connection gets dropped very quickly, possibly due to some timeout limit somewhere.

mike-code commented 8 years ago

Same issue here. I tried to manipulate with backconnect but the result was the same. After first execution it doesn't seems to work anymore. I use Windows and I used both xdebug 2.4.1 (latest) as well as xdebug.dll that came with xampp.

mike-code commented 8 years ago

I'd like to update my comment a bit. I noticed that when I start debugger in sublime text, it begins to listen on specified port. On first breakpoint it initiates a TCP connection (and holds it) as well as it stops listening. If I keep running (shift+F5), it drops the TCP connection and begins to listen again. The problem arises because it stops on first breakpoint (OK), then it jumps to another one (OK) but then there is no more breakpoints yet the TCP connection is established again (third time) and thus it stops listening. Now if I refresh the page (means I expect it to stop on the same two breakpoints as before) it won't stop on any breakpoint because it still holds this strange TCP connection and is not listening.