Intellij IDEA 12 deadlock and lost changes - intellij-idea

As you are working on the IDE, suddenly it has no reaction, the whole IDE become inactive and can not operate on it, but with high CPU usage, If you kill the process from Windows Task Manager, after it launched, all modified lost since your last edit. This problem occurs every now and then.
My environments:
Windows 7, Intel i7, 16GB RAM, IDEA 12.1.6 with auto save enabled.
Did anyone come across this problem before, it's to bad as my changes lost and i have to rewrite it after restarted.

You'll want to upgrade to v12.1.6 as 12.1.5 had a major bug in it that was fixed in 12.1.6. The bug prevented compiling of code in some circumstances. 12.1.6 was released only a few days after 12.1.5. That may not be the cause of your issue, but is still good advice.
Other than that, the 12.1.x line has been very stable. I think your issue is an isolated case as I have not seen any mention of it in the IntelliJ IDEA forums or here. Often times, such deadlocks are caused by third party plug-ins. Take a look in the logs (Help > Show Log) to see if it has any information that explains the hang. Also, if IDEA becomes non responsive, it automatically logs thread dumps in the log directory. Those may have some information.
If you experience the issue again, you may want to disable any third-party plug-ins to see if that resolves it. If it happens frequently, you can take a CPU Snapshot as described in this document and submit it to the JetBrains.
Lastly, I recommend you tweak the following setting: File > Settings > [IDE Settings] > General > Save files automatically if application is idle for x sec." Set it to 15 or 30 seconds. (You don't want to go too low). This will help reduce any loss of work in the event of a hang (which after 10 years of daily IDEA use I can attest to as being very rare.)

Related

Why would building a program fail sometimes but not others, without any changes to the source or settings? Possibly defective hardware?

I recently built a large-ish open source program in Visual Studio 2013. Initially the build failed due to a couple errors (a C1900 and a LNK2019). These errors were quite puzzling since I was following clear, simple instructions for building the program. The main developer couldn't think of any good reasons why they would occur.
I turned off my laptop overnight and the next morning I reattempted the build with the intention of reproducing the errors. But to my great surprise, no errors. I did not change any of the source or any compiler settings, etc.
Later that day I decided to do another build, and I got the same errors as before. I shut down my laptop for a minute or so, turned it back on, tried building again and it worked.
Clearly this is really strange. I have reason to suspect that there is some faulty hardware in my laptop. Could that cause these mysterious disappearing errors?
Try this on another machine and see if you get the same results. If you do, you'll know it's not a hardware issue.
It's more probable that you don't have complete build steps provided by the other developer. If he only built/tested it on his computer, then he may have added/installed (and not documented) some other tools/scripts/libraries necessary for a successful build - that he doesn't even remember about. There could also be circular dependencies between the projects which prevent you from building in one step.
You should try and identify the relationships between the projects and then build them separately, until you find where the problem is. You start with those projects not having references on any other ones, and so on. Eventually, you'll find the 'problem' project, and it'll be easier to fix.

IntelliJ idea slow/hang during debug make phase

Currently experiencing very slow debug start up times (between 25-45 seconds) with idea CE 14.1.5. To reproduce:
Make change in code that will cause javac to be invoked.
Hit debug.
Status bar shows "Make" and entire IDE hangs.
I'm using a 2015 Macbook pro and Java 1.8.0_60 64bit.
After profiling with advice from above, I tracked it down to this issue:
IntelliJ freezes for about 30 seconds before debugging
Which in turn points to an issue with InetAddress.getLocalHost() on *nix. Following the advice in this linked post certainly helped it go away:
InetAddress.getLocalHost() throws UnknownHostException
I had similar problems of starting debugging application and tried different workaround tips to figure it out, but in my case i had a lot of forgotten breakpoints marked in application and removing them all application starts and performs lightening fast.
So, my advice remove all the breakpoints from the code at least at application startup.
You should assign more memory. This almost always reduces lagging / hanging issues. You can find a guide how to change this setting in IntelliJ manual.

How to disable autosave feature on IDEA?

env: IDEA-14.0.2, kubuntu14.10 x64
Yesterday I use IDEA to learn source from Spark. When discussing with my partner, I write serval lines directly to the source, then I closed the IDEA without ctrl+S
Today when I open the project I found that those little changes still exist and make the source very dirty (and bit hard to remove them since they are everywhere). I assume that there's a autosave feature the avoid close without saving by incident.
how to close that on certain project? or do it globally?
Currently it can't be disabled. There are a few open issues in the IntelliJ's YouTrack, for instance IDEABKL-6460. There is a long discussion in this issue, but from comments like this:
Auto-saving is built in very deeply and many IDE features just won't
work without it (e.g. compilation, running, etc). For reverting
unwanted changes there's VCS, Local History and Undo.
Currently we don't plan to add a possibility to disable auto-save.
it seems that implementing this feature isn't planned and even if it was it would be probably difficult. But you can leave a comment and vote for the issue because the more people request this feature the more probable it is that it will get actually implemented sometime in the future.

PhpStorm very slow and sluggish on netbook, optimize IDE for responsiveness?

I recently upgraded from PhpStorm 6 to PhpStorm 7. Delighted to see all the improvements, but it runs awfully slow on my low-powered netbook. The delay between typing and seeing text appear is often 5-6 seconds and gets worse as line count increases. It is unusable at this stage.
How can I improve the general IDE speed and responsiveness?
Edit 2017: You may first want to try experimenting with allocating PhpStorm some more RAM if available. Do this by
Going to Help -> Edit Custom VM Options
Change -Xms and -Xmx to be something reasonable for your hardware. I have -Xms512m and -Xmx2048m on an 8GB RAM laptop.
Restart PhpStorm.
If you want to see how much RAM PhpStorm is currently using, you can go to File -> Settings and search for and enable show memory indicator.
Original answer: I made some changes to increase the responsiveness of the IDE. I'm sure there are more things one could do, but I found these to improve the performance to well within usable margins. From most effective to least:
Disable language injections: File -> Settings -> Language injections. Untick as many boxes as you're comfortable with. HTML was the real killer for me.
Disable inspections: File -> Settings -> Inspections. Untick as many as you don't need.
Disable unused plugins: File -> Settings -> Plugins. Untick unused.
These changes brought down both the startup time and significantly increased responsiveness of the IDE in general.
Add these to your phpstorm.exe.vmoptions or phpstorm64.exe.vmoptions file, at the bottom:
-Dawt.useSystemAAFontSettings=lcd
-Dawt.java2d.opengl=true
Solid speedup to the point that the editor is now actually usable.
I will for the life of me just never understand why people create editors in Java.
If you need to speed up PhpStorm right away, turn on Power Save mode.
(File > Power Save Mode or using "Hector the Inspector" icon in the IDE status bar). This mode turns off on-the-fly code inspections
This way you can finish what you have started, and later decide what code inspections to deactivate.
OUTDATED IF YOU USE A VERSION MORE RECENT THAN 2017.1 :
The most effective way to speed up new phpstorm version is an experimental feature that is going to be shipped by default in phpstorm 2017.1. Until that you can activate it on jetbrains products (webstorm, phpstorm etc.)
Click on Help => Edit custom properties
Add editor.zero.latency.typing=true
Close and open again the application.
For me the change typing is not laggy anymore.
Other tricks didn't helped me or not in a noticeable way.
Try removing unnecessary files from your project.
I had 3k+ *.html log files inside my project and that slowed down typing terribly when the 'Project' tab was open. (Hiding the project tab or turning off the PHP Plugin does also speeds up PHPStorm, but obviously those are not viable trade-offs.) (I'm using PHPStorm 2016)
In my case, PhpStorm wasn't slow at all - a bug in my monitor driver introduced severe lag, and it just happened that I dedicated that monitor to PhpStorm. If you've read this far, try PhpStorm on a different monitor, it would've saved me a lot of time.
It is possible that it will help to increase the maximum memory allocation for PhpStorm beyond its default.
For mine, it was capped at 2GB. I know you asked about a windows machine, but for mac users reading this, you can change this by opening PhpStorm without opening a project. Then hit Configure > Edit Custom Properties and change the xmx value to a higher limit.
Try to exclude the C:\Program Files\JetBrains\PhpStorm 2020.1\plugins\ folder to the windows firewall exclude directories, that will make the phpstorm run faster and indexing will be quick.
Windows firewall thinks that malicious software has been installed with lot of jar files. This solution has worked for me. But I have excluded my project laravel folder too
Possible Solutions
Use and older version of phpstorm that your machine fully supports
Disable the unwanted plugins
Disable the unwanted inspections and intentions
Disable the unwanted browser support by pressing ctrl + alt + s then Tools > Web Browsers >

How would I go about taking a snapshot of a process to preserve its state for future investigation? Is this possible?

Whether this is possible I don't know, but it would mighty useful!
I have a process that fails periodically (running in Windows 2000). I then have just one chance to react to it before having to restart it and painfully wait for it to fail again. I didn't write the process so don't have the source to debug. The failure is seemingly random.
With a snapshot of the process I could repeatedly and quickly test reactions to the failure.
I had thought of running inside a VM but this isn't possible in this instance.
EDIT:
#Jon Cage asked:
When you say a snapshot, you mean capturing a process when it's about to fail (including memory, program state etc. etc.) ...and then replaying it's final few seconds repeatedly to see what effect it has on some other component?
This is exactly what I mean!
I think minidump is what you are looking for.
You can also used Userdump:
The User Mode Process Dumper
(userdump) dumps any running Win32
processes memory image (including
system processes such as csrss.exe,
winlogon.exe, services.exe, etc) on
the fly, without attaching a debugger,
or terminating target processes.
Generated dump file can be analyzed or
debugged by using the standard
debugging tools.
This article shows you how to use it.
My best bet is to start the process in a debugger (OllyDbg being my preferred tool).
The process will pause on an exception, and you can try to figure out what happened shortly before that.
This needs some understanding of assembler and does not allow to create a snapshot of the process for later analysis. You would need to write your own debugger for that - it should be theoretically possible.