IDE frequently freezes and loses work

Issue #2595 resolved
quietopus created an issue

Roughly every 10 to 20 minutes, the IntelliJ IDE spontaneously freezes. Each time, when I restart the IDE, I find that IntelliJ has lost all work since the last save. I am not completely sure that IlluminatedCloud is the cause, but the following factors suggest this:

  • Log patterns mention exceptions and problematic behavior from IC, in proximity to the freeze.
  • The problem began roughly a few days ago, around the time I installed the latest IlluminatedCloud release.
  • The problem does not occur when I work on non-Salesforce-related projects.

I do not know how to reproduce it because it happens spontaneously as I am editing, with no clear indicator of the cause, other than that it usually seems to happen while I am editing a piece of code. This has become a frustrating obstacle to productivity, as I need to repeat roughly a few minutes of work for every 10 to 20 minutes or so of work that I do. The more quickly and productively I work, the more I must redo each time the IDE freezes.

The attached file (which includes the quoted section below) contains a log section which occurred in proximity to the freeze and seems to do so for other instances of freezing. Besides Exception stack traces, the log includes the following:

2024-07-09 20:38:02,542 [ 481666] SEVERE - #c.i.u.c.ThreadingAssertions - IntelliJ IDEA 2024.1  Build #IU-241.14494.240
2024-07-09 20:38:02,542 [ 481666] SEVERE - #c.i.u.c.ThreadingAssertions - JDK: 17.0.10; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-07-09 20:38:02,542 [ 481666] SEVERE - #c.i.u.c.ThreadingAssertions - OS: Mac OS X
2024-07-09 20:38:02,542 [ 481666] SEVERE - #c.i.u.c.ThreadingAssertions - Plugin to blame: Illuminated Cloud 2 version: 2.3.2.1
2024-07-09 20:39:54,090 [ 593214]   WARN - #com.illuminatedcloud.intellij.builder.validate.AsYouTypeEventProcessor - Error while trying to compile.
java.lang.IllegalStateException: Calling invokeAndWait from read-action leads to possible deadlock.

I am running this on a Macbook Pro M3 laptop with 8192 MiB of memory allocated in IntelliJ’s memory settings (36 GB total on the machine).

Comments (7)

  1. Scott Wells repo owner
    • changed status to open

    Thanks for filing and apologies for the issue. It looks like this is a result of the recent change to reroute deployment requests for implementations active Schedulable types and/or their transitive dependencies via the Metadata API when Tooling API based-deployment is enabled for Apex. It specifically looks like it's happening during as-you-type validation. Assuming those assumptions are correct, you should be able to (temporarily?) disable as-you-type validation -- minimally for Apex -- to work around these freezes.

    I'll investigate whether or not check-only deployments of active Schedulable classes via the Tooling API result in the same incorrect failures and, if not, I'll disable that logic for check-only deployments. If it does result in the same incorrect failures, I'll need to decide whether to always perform check-only deployments via the Metadata API or if there's some other optimization that can be performed in that specific situation.

  2. Scott Wells repo owner

    I’ve easily reproduced the behavior you’re seeing and have implemented a fix. As stated previously, the core issue is that the new check for deployment of active Schedulable implementations and/or their transitive dependencies cannot occur during as-you-type validation deployments. However, I didn’t want to fault all as-you-type validation deployments by requiring them to be re-routed to the Metadata API, so I’ve compromised on re-routing to the Metadata API it it’s an as-you-type validation deployment for Apex and the project contains Schedulable implementations. Any further checks would either be insufficient or too expensive for something that’s happening as the user is actively editing the class.

    This fix will be included in the next official build. As mentioned above, disabling as-you-type validation for Apex will provide a workaround for these IDE/editor freezes in the interim, and you should safely be able to re-enable validation if desired once you update to a build with the fix.

  3. quietopus reporter

    Thanks, Scott!

    It was really happening a lot when I filed this yesterday. But it hasn’t happened much at all since then, though I haven’t installed any updates or changed any settings. I suppose it depends on what I am working on. Until the next release, I’ll keep the workaround in mind if the issue comes back.

    I appreciate the help!

  4. Scott Wells repo owner

    Hi. The update with a fix was released today. See the link to 2.3.2.2 in my previous comment above.

  5. Log in to comment