Problems Debugging Javascript Release 2022.2.2
I accidentally submitted a post to EAP Users so am repeating it here to ensure it doesn't get overlooked. I have had many problems with the debugger while debugging JavaScript.
One problem is that once break points are placed inside the javascript, even when you run the app in run mode and NOT debug mode, it still stops at the breakpoints.
The other problem is that sometimes, when debugging it goes into the war file instead of the source code. Once it does this, it seems to get stuck there and any debugging after that goes into the war file. Today I tried everything to clear what might be causing this, such as invalidating the cache and restart. This didn't work so I deleted the .idea folder. This is a pain because I have to reset the configuration. But still when I tried to debug the javascript it went into the war file instead of the source code. If I try stepping over it stops in comment lines so becomes impossible to use. The debugger for javascript is now useless to me.
Yesterday I uploaded my entire project so you can see where it is going into the war file. There is a README.txt file inside the uploaded folder. The upload ID: 2022_10_09_51PjiiSK9ntrfNGp7SMUro
Please help because I just paid a twelve months subscription to get the javascript debugger and now it's not working. My previous submission went to Yaroslav Bedrov who said he was waiting for me to upload the project.
请先登录再写评论。
An extra note. I discovered that if I shut down the server and app and then restart and go into run mode and then back into debug mode, then the debugger stops going into the war file. Something very weird is going on.
It didn't last. Once I did another run, having left breakpoints in the javascript, it once again stopped at the breakpoints while in run mode. I then shut down and restarted in debug mode and it was back in the war file.
Hello,
I answered you yesterday on EAP forum. I couldn't reproduce the issue with provided project. Probably I'm missing something or there is misconfiguration in IDE. Is it possible to attach screenshots demonstrating wrong navigation?
Thanks for your time Yaroslav. You are right. I ran the project that I uploaded to you and it is not going into the war file any more. I have had this happen a few times. The only thing I can think of is there must be some specific sequence of steps that I am doing that gets it into this state. But until I can trace those steps and repeat the problem reliably, there probably isn't anything more you can do. I will try to keep track of what steps I am doing so I can report exactly what caused it.
Thanks! Feel free to contact me and we'll continue investigation.
While debugging today it suddenly went into the war file. I was doing too many things to know the exact sequence of actions that led to this. But, I am sending a screen shot to prove to you that I am not dreaming. You can see from the file heading at the top and the highlighted file that it has gone into the war file.
Unfortunately, I still couldn't reproduce the issue on my side. Seems we'll need exact steps to reproduce.
I know. I sent the screen shot just so you could see there really is a strange issue here. You could perhaps send it to your development team to give them a heads up in case someone else has a similar issue. They could at least keep a look out for it.
Hello,
Such cases may occur when source maps are different. Please check that there are no background third-party processes running that might change initial source code, so IDE navigates into the deployed artifact.
The only thing I have running is intelliJIDEA which starts the Tomcat server. That's it. I am still seeing this problem on a daily basis which is making using the debugger painful. I have found a way to get out of it when it occurs. I uncheck the checkbox in edit configurations to debug with javascript. Then I stop the app and the server and restart debug without javascript. Once it has run without javascript debug it seems to clear itself. I then go back and change configuration to debug with javascript and restart the server and app. Having to go through this process when the javascript debugger gets stuck in the war file is most time consuming and annoying. But at least I have found a way to get out of it and continue. I won't give up trying to find a way to reliably reproduce this problem. One day we will solve this issue.
Sorry, but we still couldn't reproduce the issue on our side. Is it reproducible with other projects?
I will have to spend some time investigating with a smaller test project and see if I can find a way to reliably reproduce the problem. I will get back to if I can find exact steps to reproduce.
Thanks! I'll be waiting.
Hello Yaroslav
I have played around with a test project today and managed to repeat the issue of the debugger going into the war file. I have uploaded the entire project with the following ID:
Upload id: 2022_11_10_21wpdMwaV9cv4c5w35ctpK (file: TableDemo.zip)
Please note this isn't a real project, just one for playing around testing ideas. I have included in the zip file a README.rtf that has all the steps to repeat the problem. I managed to repeat it more than once. I have been very explicit with the steps to repeat.
Nothing is running on my machine other than intelliJIDEA and the tomcat server that it starts.
Thanks for the example and instructions. On my side on the third step file is opened from "src/main/webapp/script.js" not from WAR file. Could you please try to update to the latest IDE version?
Hi Yaroslav
I restarted my PC today and followed my instructions just to ensure the problem could still be repeated. It was repeated. Still going into the war file.
I then followed your instructions and updated to the latest version 2022.2.3 build 222.4345.14. I uninstalled everything including cache and settings. I had to reset everything. But, the good news is that the problem of going into the war file was not repeated. Hopefully, the new version has fixed the issue. I shall keep a lookout if it occurs again but I'm optimistic the new version appears to have resolved these issues. I notice some changes. Under "edit configurations" there are now only two options - on "update' action is Restart server or Redeploy. This is different so perhaps they found some issues with the way it was before and fixed them. Thanks for persevering.
Nice to hear that! Feel free to contact us if you face the issue again or will need any assistance.
Dear Yaroslav
My elation was short lived. When I went back to the project I am working on and tried to debug with javascript it immediately failed, going into the war file. No matter what I do I can't stop it going into this file. I have noticed that the code inside the war file is also not the latest build. I have taken a screenshot of the file where it stops at line 316 in RetirementCalculatorAustralia_1_0_SNAPSHOT\...\navigation.js. You will see in the screen shot the actual source code file inside webapp\...\navigation.js is beside the war file in the tabs. I have then gone into the actual source code file where the breakpoint is and taken a snapshot. You will see that the code just after line 316 is different to the code in the war file. I put a new method at line 317 and rebuilt the project before restarting the server. But the war file is going into the old code. Something very wrong here. I am now unable to use the debugger because I can't get it to go into the correct source code.
I have also added a screenshot of my configuration. It doesn't make any difference if I select "redeploy" or "restart server".
Dear Yaroslav
I am afraid I have lost patience with intellijIDEA. For days I have been unable to progress with my project because I cannot get the debugger to stop going into the target war files. It is useless to me. I wanted to go back to version 2022.2.2 but when I went into my account the only version I could see available for download was 2022.2.3. I'm ready to throw it out. Unfortunately I have paid 12 months' subscription so I have lost that money. I am thinking of having a look at Eclipse. At least it is free. Paying for a product I cannot use is just not good enough. I used to love intellijIDEA when I used it on a java project at my last employer. But since you've added the javascript debugger it seems to have turned into a piece of junk. And it was for the javascript debugger that I paid the subscription.
At my last employer our customer was the Australian Defence for which we developed large complex defence systems (not web apps). We used intellijIDEA for java and it was excellent at that time. That is why I purchased it for personal use. When something in the applications we developed for the defence force wasn't working, we didn't have the luxury of telling the defence personnel to go find a way to repeat the bug. We simply just didn't get paid the next instalment until we ourselves tracked down the problem and fixed it. But it seems at intellijIDEA the customer must find the problem themselves. I don't want to spend any more of my valuable time trying to find a way to repeat a problem, upload a project, only to be told it cannot be repeated and the problem is left with me. I must do the work to find it. I will not recommend your product for web development to my other colleagues who still work with large defence projects.
I'm trying to be polite in my anger but since purchasing this product I have been unable to use the debugger properly. If it is some kind of setup issue then it is not my fault. You need to design a product that doesn't fail if the setup isn't correct or at the very least gives the user some information on exactly how to fix it.
I am now completely stuck with version 2022.2.3 and unable to progress. At least tell me how I can get back to 2022.2.2 to see if I can get something working. This is so disappointing because I have liked many other aspects of intellijIDEA but I'm afraid I've come to the end of my patience.
In desperation I tried a couple of extra things. First, I deleted everything in AppData/Local/Temp. Then I renamed .idea file and restarted. I went into "edit configurations" and selected the local Tomcat server. There was a warning icon in the bottom right saying "fix". I clicked on this and it took me to the Deployment tab where I had to select a war file or war exploded file. I selected war exploded.
I wasn't given this choice when I first installed version 2022.2.3. On that occasion the only choice I had in "Deployment" was to select the folder RetirementCalculatorAustralia-1.0-SNAPSHOT.
Also, in "edit configurations" the "On frame deactivation" options had changed from the first install. In version 2022.2.2 they were "Do nothing", "update resources" or "update classes and resources". This was not available when I installed 2022.2.3. The options then were "Redploy" or "Restart Server". I checked and it is version 2022.2.3. But it appears to have gone back to the options in version 2022.2.2. I selected "update classes and resources". I then checked "use javascript debugger" and restarted the debugger. This time it worked.
There are obviously some major problems here. I can at least proceed for now but who knows for how long. I really shouldn't have to delete .idea file every time an issue occurs and restart. How on earth has the options in "edit configurations" changed?
I also noticed that under C:/Users/<myname>AppData/Local/JetBrains there is a directory called IntelliJIdea.2022.2. This looks brand new since I deleted .idea and restarted.
Sorry for such experience. Seems there was some issue with project configuration, so folder was deployed instead of artifact. That's why old code was shown and debugger navigated to deployed code instead of sources. As project configuration is stored locally it wasn't copied with sample project and I couldn't reproduce the issue on my side. We'll check what might cause such cases to avoid them in future.
I think you are on the right track. I have had this issue of the debugger going into old deployed code instead of source code many times. I have now discovered that if I delete the folder in local storage located at users/<user name>/Local/JetBrains/IntellijIdea2022.2 then I can get out of the problem. It's a nuisance because I have to stop and restart intellijIDEA whenever this problem occurs, which is quite often. But deleting this folder doesn't seem to break anything and nothing needs to be reset afterwards.
I would say there is a bug somewhere in that folder or whatever is causing the debugger to search in that folder when it shouldn't. If it helps I can upload my local storage folder to you next time the issue occurs but I don't want to upload my entire project.
It will help a lot if you could provide both states for that folder - broken one and working one. Thanks in advance!
Hi Yaroslav
I have been playing around with a small toy project for a date picker when I came across the problem of the debugger going into the war file. Fortunately, I zipped the local folder when it was working so was able to zip up the broken one as well. In addition I have uploaded the entire project, which is only small. I had a break point in datepicker.js line 32. Here is the upload ID:
2022_12_03_2ACofEBxohb9umER2mnjBM (files: IntelliJIdea2022.2-working.zip and 2 more)
I noticed that it appears to occur after I make a change in the source code and then go back to debugging.
I hope with all this data your engineers will be able to do an analysis of what is different between the working and broken folders and find the problem.
Thanks a lot for the provided information! I passed it to developers for investigation.
> I noticed that it appears to occur after I make a change in the source code and then go back to debugging.
Could you please add more details about this part? Do you edit java or js code? Do you edit it while application is running? Do you reload application after changing sources?
It happens when debugging in javascript. Here are the steps:
1. When breakpoint is reached, step through until I find a bug.
2. Modify source code.
3. Press Ctr+F5 to refresh the page. This makes the debugger stop at the previous break point. But when I step to the next point it goes into the war file.
In the edit configurations panel I have selected 'Update classes and resources' for both 'On Update action' and "on frame deactivation'. I thought it was supposed to update the classes on frame deactivation. Perhaps this sometimes doesn't work when debugging javascript.
It seems nothing more has been done to try to fix this problem. I am now pretty fed up with intellijIDEA. Almost every time I use it for javascript debugging it ends up in the war file and old code. I continually have to shutdown and delete the folder in AppData/Local/JetBrains and then restart. This is very inconvenient and enough to make debugging javascript useless. I doubt I will renew my subscription if this issue is not fixed. It makes working with intellijIDEA painful. I have already provided as much info as I can. Nothing has come from my last message in December. I thought everyone went on Christmas holidays and never came back. This really is a serious issue debugging javascript.
Hello,
Sorry for the delay. It took more time for investigation as different subsystems are involved. Seems finally we could find the issue. We suppose that artifact is not updated after code change and not uploaded to Tomcat. Please try these steps:
1. Install "Live Edit" plugin
2. Run debug
3. Stopping at breakpoint and change code
4. Open Run window with Tomcat run configuration (it might be in Services tool window).
5. Click on "Update" button ands select update classes and resources
6. Step through the code.
Now it should be navigating in source code, not in artifact.
Bravo!
Finally, this solution with Live Edit appears to be working to solve the issue. If I encounter any further problems I will let you know. I'm optimistic because what you describe sounds very plausible as the cause of the problem.
I sincerely hope that now the cause of the issue has been found that it will be fixed in the next release because it is a serious issue. It took a bit of effort on my part, but I hope we have tracked it down. I deserve a discount on my next subscription for helping you find this bug after all this time. I don't expect it but it would be a nice gesture after all the time and effort I put into this.