IDE locks up when refactoring and injecting a new If statement block

Issue #1058 resolved
John De Santiago created an issue

Had this happen twice today. Essentially I am doing some refactoring and I have a method where I am attempting to inject a new if statement. When I do that the IDE locks up and I have to force quick IntelliJ. I got around it the first time but just deleting the method and rewriting it from scratch and continued working. Then in another method, for a brand new class, it happened again. I am on the most current version of both IC and IntelliJ. I have the IDE up while I write this and it is still spinning (it's been 5 minutes).

Oh if it helps the first time this happened it was before the update you pushed out today. I updated just to see if it possibly resolved the issue but still get the same issue.

I attached the thread dumps that I got and the latest idea.log file that I have from my last startup.

Comments (10)

  1. Scott Wells repo owner

    Sorry for the issue, John, and thanks fro the thread dumps. So just to repeat back some of what you've said, this problem occurred on both today's build (2.0.3.0) and a prior build, correct? In other words, it's not a new issue from today's build in particular.

    From the attached log, it looks like you're running the latest build of IntelliJ IDEA, 2018.2. The only difference between what you're using and what I'm using is the OS...just trying to suss out environmental contributors.

    Let me review the thread dump. I do see at least two threads with stacks going through IC code, and they're both in waiting states, though it doesn't look like a circular dependency at a glance. Nonetheless, this does smell like a variant on a class deadlock. I'll let you know what I find.

  2. John De Santiago reporter

    Correct. It happened before the build from today. In fact, it just happened again but this time I was typing the statement List<Database.SaveResult> as soon as I closed that statement it locked up. I could try to rebuild the project and see if have the same issues. Earlier before the lockup, IntelliJ asked me to allocate more memory to it. It's a bit ugly org that I am working in.

  3. Scott Wells repo owner

    Okay, obviously this is happening with high enough frequency we need to get to the bottom of it for you. The fact that you're bumping up against a memory ceiling is promising in that I could see that being a contributor. How much heap size have you allocated to the IDE? I generally choose 2-3GB which gives quite a bit of breathing room. It's also worth pointing out that based on my own work this weekend, I think that 2018.2 may have a slow memory leak that didn't exist in 2018.1, though I have yet to confirm that. I was seeing a gradual increase in memory across my work day that I didn't see until VERY recently.

    Let's also do a full house-cleaning on your caches and indices. Between the IDE update and the plugin update, it's possible something wonky is hanging around. You can reset just IC's indices with Illuminated Cloud>Configure Project using the Rebuild Caches and Indices button. If you want to reset all of the IDE's caches and indices (including Local History which may not be a good thing for you), you can use File>Invalidate Caches / Restart. I would say let's start with the IC-only reset plus an increased heap and see whether that addresses the issue. I'll also keep looking into things on my side based on the thread dump you provided.

    If it does continue to happen, I may request that you drop back down from 2018.2 to 2018.1.6 (or whatever the latest build of 2018.1 is) to see if it happens there as well. I'm still suspicious of an issue introduced with 2018.2...

  4. John De Santiago reporter

    I went ahead and invalidated caches. Not a big deal to lose local history. I have backups and most but a few are on version control. This is my JVM config. Open to suggestions on upping these values if you have some some optimal settings in mind. I have 16GB of mem on my macbook so no worried about allocating more memory.

    -Xms128m -Xmx1125m -XX:ReservedCodeCacheSize=240m -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xverify:none

    -XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log -XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof -Xbootclasspath/a:../lib/boot.jar

  5. Scott Wells repo owner

    John, the really critical one there is -Xmx1125m. You've just allocated a little over 1GB of memory to the process. I know it sounds silly to say so, but that's not much breathing room for an IDE these days even with a moderate project. Whether I'm using IntelliJ IDEA for Java, Python, or Salesforce via IC, I always bump that value to at least 2048m and often 3072m. If you have 16GB of physical memory, I'd recommend you bump it to 2048m for starters and see how that works for you. Java processes just don't behave well when they reach the memory limit, so let's rule that out entirely if possible. Between the cache/index reset and that type of IDE config adjustment, let me know how things look.

  6. John De Santiago reporter

    Thanks, Scott. I will bump that up to 2048 and see how things go. Right now things are running ok. I haven't had any issues since invalidating the caches. I also went ahead and created a new project as well just to make sure I had a clean copy of everything.

  7. John De Santiago reporter

    Sorry, Scott, it happened again. I enabled the memory monitor so I could see if it was spiking but it was sitting at 539 of 1981m when it locked up. At the time I only had two tabs open and was modifying an if statement when it locked up. I might need to downgrade IntelliJ since it seems to me the issues started after upgrading. Unless you have any other suggestions.

  8. Scott Wells repo owner

    Okay, I would recommend that you go back to 2018.1.* and see if the problem still occurs. That would isolate it to an IntelliJ issue or an IC issue. If it recurs on 2018.1, then it's very much mine to fix. If not, I know that JetBrains is readying a new release of 2018.2, so perhaps it would make sense to sit tight on 2018.1 until 2018.2 is patched a bit. They made some pretty significant changes in this base IDE release and it wouldn't be the first time I've seen the first iteration or two have problems. Sorry to ask you to throw proverbial darts, but with problems like this, it's all about isolating and eliminating the variables.

  9. John De Santiago reporter

    Thanks for your help. I downgraded and just setting up my project again to make sure no issues. I got to run and figure dinner out but will let you know if this resolves the issue.

  10. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  11. Log in to comment