View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001771 | Xdebug | Step Debugging | public | 2020-03-24 18:55 | 2020-03-25 15:59 |
| Reporter | samuel.nogueira | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | no change required | ||
| OS | Linux | ||||
| Product Version | 2.9.4 | ||||
| Summary | 0001771: Cannot step debug fork child processes | ||||
| Description | While debugging a script which forks, I expected step-debugging to be available in child processes, but only works in the parent process instead (xdebug log in attachment). | ||||
| Steps To Reproduce | Debug the following script, with 2 breakpoints: <code php> echo "started\n"; Expected execution to immediately stop at breakpoint no. 2 | ||||
| Additional Information | PHP 7.4.0 (cli) (built: Nov 28 2019 20:31:53) ( NTS ) PhpStorm 2019.3.4 Docker version 19.03.3, build a872fc2f86 | ||||
| Tags | No tags attached. | ||||
| Operating System | Linux | ||||
| PHP Version | 7.4.0-7.4.4 | ||||
|
|
Seems this wasn't an issue in versions prior to 2.7.0, could be related to https://bugs.xdebug.org/view.php?id=938 |
|
|
Hi, Prior to 2.7.0 this didn't work at all :-) I think the problem here is that Xdebug only checks whether to make a debug connection when a function is called, otherwise it would be way too slow. (It's already too slow, but there is 0001755, with a PR: https://github.com/xdebug/xdebug/pull/556). I think that if you put the "echo" in a function, and call that function in your "} else {" case, you will see that the forked process will make a separate connection to your IDE. cheers, |
|
|
Couldn't test with newer PHP versions, but at least with PHP 7.2.29 + Xdebug 2.6.1, it was working, execution stopped in each breakpoint, even without changes to the script (still using echo). Kindly see attached Xdebug remote log, Dockerfile and screen cast: |
|
|
Did you not see/read my second paragraph? I think the problem here is that Xdebug only checks whether to make a debug connection when a function is called, otherwise it would be way too slow. (It's already too slow, but there is 0001755, with a PR: https://github.com/xdebug/xdebug/pull/556). I think that if you put the "echo" in a function, and call that function in your "} else {" case, you will see that the forked process will make a separate connection to your IDE. |
|
|
I did, and I did try it out first, but it didn't made a difference, sorry I didn't mention that in the note. |
|
|
It works here, see the attached video. Do you have PhpStorm's "Max. simultaneous connections" set to something higher than "1"? |
|
|
Yup, during both tests 'Max. simultaneous connections' was set to 3. For me, issue can be closed, there is no problem after all. Thank you! |
|
|
Ah, I see that in your log now:
Before Xdebug 2.7, it only worked by chance. Both parent and child would share the same connection, and if data got out of sync in any way, which was quite easy to occur, the debugger would get mega confused. With the fixing of 0000938, it now makes a new connection per child. If you and your team like it, perhaps you can support me working on Xdebug ;-) -> https://xdebug.org/support |