# Changes in Threading Framework in IntelliJ Platform 2025.2

**URL:** https://platform.jetbrains.com/t/changes-in-threading-framework-in-intellij-platform-2025-2/1920
**Category:** Announcements
**Tags:** coroutines, threading, api
**Created:** [June 5, 2025, 1:51pm UTC](https://platform.jetbrains.com/t/changes-in-threading-framework-in-intellij-platform-2025-2/1920 "2025-06-05T13:51:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![konstantin.nisht](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/konstantin.nisht/32/186_2.png) [@konstantin.nisht](https://platform.jetbrains.com/u/konstantin.nisht)
#### Post date: [June 5, 2025, 1:51pm UTC](https://platform.jetbrains.com/t/changes-in-threading-framework-in-intellij-platform-2025-2/1920/1 "2025-06-05T13:51:05Z")

</div>

Hello everyone!

We would like to share with you important updates of the threading framework in IntelliJ Platform 2025.2.

The most notable change of this release is that we are starting to execute some write actions on background. This functionality still remains internal, as we need to ensure that the Platform works smoothly with this new setup. For now, only certain write actions on project startup are changed for background execution. Write actions on UI thread will be supported further.  
If you feel that it brings any problems, consider setting the system property `-Didea.background.write.action.enabled=false` for your IDE. Typical example of problems is that some of the listeners for MessageBus topics that were meant to run on EDT may run on background threads. Don’t hesitate to reach out if you have any feedback.

Other changes in the threading framework:

1. If a thread is blocked on acquisition of the Read/Write lock, then it will react to external cancellation and throw an instance of `CancellationException` without proceeding further. This is similar to [prompt cancellation guarantee](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/suspend-cancellable-coroutine.html) from kotlin coroutines library.  
It means that the following code:

```kotlin
coroutineScope {
  launch(Dispatchers.EDT) {
    runWriteAction { 
      // long operation
    }
  }
  val job = launch(Dispatchers.Default) {
    runReadAction {}
  }
  job.cancelAndJoin() // <- this will be promptly completed because lock acquisition in `runReadAction` is now cancellable.
}

```

1. `suspend fun readAction` is no longer rescheduled with `invokeLater` ([IJPL-186444](https://youtrack.jetbrains.com/issue/IJPL-186444/Do-not-use-invokeLater-for-rescheduling-of-read-actions)). It may cause increased number of cancellations in your code. Unfortunately there is no easy way to diagnose it, but replacing `readAction` with `runReadAction` may help.

2. Sometimes you may see deadlocks that mention `blockingWaitForCompositeFileOpen`. Most likely, it means that you are opening a file under write lock (like in `com.intellij.openapi.fileEditor.FileNavigator#navigate`). In this case, consider making opening of the file asynchronous, i.e., surround your navigation logic with `Application.invokeLater`.

3. `ApplicationListener.beforeWriteActionStart`, `ApplicationListener.writeActionStarted`, `ApplicationListener.writeActionFinished`, `ApplicationListener.afterWriteActionFinished` now may be invoked on a background thread instead of only EDT. Consider removing access to UI from your listeners or delay it with `Application.invokeLater`.

4. `currentThreadCoroutineScope` is now stable and it can be invoked only when there is an outer `withCurrentThreadCoroutineScope`. It is fine to continue using this function inside `AnAction.actionPerformed`.

5. Functions `runBlockingCancellable`, `currentThreadCoroutineScope`, and `coroutineToIndicator` are promoted to stable.

6. `blockingContext` is now no-op and deprecated ([IJPL-445](https://youtrack.jetbrains.com/issue/IJPL-445)). Since 2025.2 IntelliJ platform manages thread contexts automatically.

---

<div class="post-metadata">

### Author: ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)
#### Post date: [June 6, 2025, 12:56pm UTC](https://platform.jetbrains.com/t/changes-in-threading-framework-in-intellij-platform-2025-2/1920/2 "2025-06-06T12:56:54Z")

</div>

Hi, is it already testable with the latest 2025.2 EAP?

---

<div class="post-metadata">

### Author: ![konstantin.nisht](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/konstantin.nisht/32/186_2.png) [@konstantin.nisht](https://platform.jetbrains.com/u/konstantin.nisht)
#### Post date: [June 6, 2025, 1:09pm UTC](https://platform.jetbrains.com/t/changes-in-threading-framework-in-intellij-platform-2025-2/1920/3 "2025-06-06T13:09:33Z")

</div>

Hi Jonathan,  
Yes, it is.
