1

I'm using Xdebug and PhpStorm to debug a PHP application.

It's all working perfectly in terms of actually doing the debugging, however, intermittently PhpStorm will remove all the breakpoints I've set up.

There seems to be no pattern or action which is causing this, so far it seems totally random (although I know it's probably not).

Here's what happens:

  • I add 10 or 15 breakpoints to various files.
  • I setup a load of test data to figure out a problem.
  • I start debugging and realise it hasn't stopped at any of my breakpoints, so I check the list of breakpoints in PhpStorm and they've all disappeared.. so I have to go back to step 1 and redo all my test data and remember where breakpoints were set.

IntelliJ / PhpStorm support say they've never heard of this happening before, and are just telling me to essentially "factory reset and try again" to see if it helps.

I'd prefer to keep that as a last resort because it'll take me ages to get everything back how I want it so I'm hoping some other people have experienced this and I'm not just going insane?

I'm on the latest version 2021.3 (Build #PS-213.5744.279, built on December 2, 2021)

I've been doing a lot of debugging today and it's happened 7 or 8 times. Sometimes it won't happen all day.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
BT643
  • 3,495
  • 5
  • 34
  • 55
  • 1
    *"...and are just telling me to essentially "factory reset and try again" to see if it helps."* You should do it just to see if that helps (as this may give some hints). You can restore prev settings from a backup (that option should do it before the reset or you can make a backup of config file manually). – LazyOne Jan 05 '22 at 17:15
  • I'll try it when I can get some free time, but once I've reset it'll probably take me at least an hour to setup the project and xdebug again I imagine. Will have to wait until the weekend to give it a go. Because it's intermittent I'd then have to do development for x hours with unusual settings until it randomly happens. – BT643 Jan 05 '22 at 17:17
  • Anyway: I also never heard of loosing breakpoints in such a manner before. Maybe it's related to the VCS (in case if you track `.idea` there) .. or perhaps can be linked to changing Run/Debug Configurations (I know watches are linked to that, not sure about breakpoints). BTW -- when/at what moment do you loose them? Like: it's working, you do debugging .. and then on next run they are all just gone? – LazyOne Jan 05 '22 at 17:18
  • I did consider git initially, but I hadn't changed branch when it happened or done any git actions so it's looking unlikely. It varies. Several times today it's been as you've described, debugging fine, go to do another run of the same scenario and it's removed all my breakpoints between run 1 and 2. But one today I was doing a global search (Ctrl + Shift + F), and when I pressed ESC to close the search modal, I actually saw all the red dots (breakpoints) disappear. I tried the same action again and couldn't reproduce that though. – BT643 Jan 05 '22 at 17:21
  • If it happens randomly: try to remember when it happens; then check the `idea.log` (`Help | Show Log in XXX`) for a possible hints (some exceptions/error messages etc)... BTW: PHP breakpoints are normally saved in `.idea/workspace.xml` file -- look for `` node). Maybe that file gets modified externally somehow (just a thought)... Note that config files may not be updated immediately, the Save _may_ happen on closing the project only. – LazyOne Jan 05 '22 at 17:24
  • Another thought: try with all custom (not bundled by default) plugins disabled. Some plugins can cause changes/troubles in loosely related areas. At very least you will see if that's the case or not. – LazyOne Jan 05 '22 at 17:27
  • @LazyOne Thanks for all the additional info, really useful! Good shout on disabling plugins, I tried that this morning but the issue still happened so we can rule plugins out of being the cause. I've tried starting from scratch just now, will see how it goes and try your suggestion of checking the idea.log if it happens even on a fresh project. Thanks – BT643 Jan 06 '22 at 11:20
  • 1) Not sure how helpful this will be (how easy to implement it on your end) but anyway: if it will keep happening even after a starting from scratch, think about recording your screen with some software (hopefully you have some spare space on your disk) -- it may give some hints on what else this might be. maybe some accidental click or keypress somewhere (for keypresses -- maybe even try a plugin/app that shows what shortcut was pressed -- can be very annoying though to see the shortcuts popping out... – LazyOne Jan 06 '22 at 11:45
  • 2) If a settings reset will help (do not do too much config after resetting -- just try to work with defaults till you see if it's still reproducible) then you can recover most of your config back from the backup files (will have to be done individually though, so that you do 1-2 files at a time -- things like Code Style, Colors, External Tools, keymap etc can be easily recovered). P.S. Using a diff tool on working and old/bad config may point to susp places (using common sense to spot them). – LazyOne Jan 06 '22 at 11:49
  • @LazyOne Thanks for all your help, some of your info helped me get to the bottom of what was going on! :) (see my answer) – BT643 Jan 06 '22 at 14:43

1 Answers1

2

So, apologies, I didn't even think to mention that I'm also using DataGrip (another IntelliJ IDE for DB tools), it turned out because I was using these on the same directory, they were conflicting with each other and overwriting the file it stores breakpoints in (thanks @LazyOne for that info!).

There's apparently no way of having them use the same project independently, so I've had to use a slightly different folder in the project for DataGrip. Probably cleaner solutions available but this will do for now!

Thanks everyone.

BT643
  • 3,495
  • 5
  • 34
  • 55
  • 1) You can use the same folder (actual code files).. but it will be **separate** configs (project settings). A little bit of manual tweaking to have it this way, nothing big. Please describe how you are using them. 2) Please also describe why you need DataGrip. Currently PhpStorm has the same functionality as DataGrip in DB management/access regard. – LazyOne Jan 06 '22 at 15:16
  • i use the same setup as OP. For me, it's focusing on PHP and debugging in Storm, while having quick access to several data connections i manage, but also work on SQL files in the PHP project. Sure, some redundancy, but focused tasking. If i get the chance to make config changes that successfully separate them, i'll come back and post an answer. – cautionbug Feb 16 '22 at 17:37
  • https://gist.github.com/vipulmathur/7d4f3dde35674874892ca61442fdf8f5 - This actually turned out to be pretty helpful. It's a workaround - several issues have been made for an "official" solution. But this explains how to set each IDE project up in its own folder, and symlink (or junction in Windows) to the project code from each IDE folder. – cautionbug Feb 16 '22 at 18:30