



I'm having some debug issues. If I set the debugger to take an available system port, it changes every time I close/open Komodo, at which time I have to go change my xdebug.ini (included into php.ini) and restart apache.
If I set it to a specific port, then for some reason when I open the program it often gives me an error saying it could not bind to that port. If I wait patiently (ok, that's a lie...I'm not very patient, I'm ver ADD), after a while I can click Debug->"Listen For Debug Connections" and it'll work.
Is there something I can do either to my php.ini or my settings in Komodo (or anywhere else for that matter) to fix this?
Hi Aaron,
If the debugger port still has some tcp/ip connections attached to it when shutting down, the port can often become unavailable on the next Komodo restart (even though the original starting process has completely finished). The OS will eventually finalize and close all the socket connections after a specific period of time (it's usually 30 to 60 seconds) and then you should be able to restart Komodo (or use the "Debug->Listen For Connections" menu) and the debugger listener port will bind properly.
You can make your own customizations to the Komodo code to work around this problem, in the file:
[komodo_install]/lib/mozilla/python/komodo/dbgp/serverBase.py
search for SO_REUSEADDR (line 225) and uncomment the 4 lines to look like this:
socket.SOL_SOCKET, socket.SO_REUSEADDR,
self._server.getsockopt(socket.SOL_SOCKET,
socket.SO_REUSEADDR) | 1)
self._server.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self._server.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1)Be sure to read the comments above this code for why this is not done by default.
Cheers,
Todd
You can also use pydbgpproxy as a separate service. It can listen on a specific port. Configure Komodo and xdebug to talk to the proxy, then this issue will go away (unless you are stopping/starting the proxy all the time)