# Migration from Akka 2.5 to 2.6 caused deadlock

**URL:** <https://discuss.akka.io/t/migration-from-akka-2-5-to-2-6-caused-deadlock/8555>\
**Category:** Akka Libraries\
**Tags:** scala, configuration\
**Created:** [July 23, 2021, 2:50pm UTC](https://discuss.akka.io/t/migration-from-akka-2-5-to-2-6-caused-deadlock/8555 "2021-07-23T14:50:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![soylent-grin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/soylent-grin/32/2485_2.png) [@soylent-grin](https://discuss.akka.io/u/soylent-grin)\
**Post date:** [July 23, 2021, 2:50pm UTC](https://discuss.akka.io/t/migration-from-akka-2-5-to-2-6-caused-deadlock/8555/1 "2021-07-23T14:50:17Z")

</div>

I used to maintain pretty huge app on top of Play 2.7 (Akka 2.5). Bumping Play version to 2.8.8 caused random deadlocks during startup.  
Unfortunately, app does not strictly follows “do not block” imperative; for example, some blocking code in beans’ constructors (i. e. `Await.result(dbFuture, Duration.Inf)`) takes place. In previous years of support I managed to make it work (including deployments on single-core CPU servers) by using this default-dispatcher configuration:

```auto
akka {
  actor {
    default-dispatcher {
      type = Dispatcher
      fork-join-executor {
        parallelism-min = 8
        parallelism-max = 64
        parallelism-factor = 3.0
      }
    }
  }
}

```

While updating to Play 2.8 and Akka 2.6, I noticed webserver becomes unavailable on 1 or 2-core servers and on dev machines (if parallelism-max is reduced to 8). Thread dump showed `application-akka.actor.default-dispatcher` locked by each other in tree-like manner, some of them stuck at those `Await.result(dbFuture, Duration.Inf)`.  
Increasing `parallelism-min` solves current problem, but in unstable way.  
I also found [this note about internal dispatcher](https://doc.akka.io/docs/akka/2.6/project/migration-guide-2.5.x-2.6.x.html#internal-dispatcher-introduced), that was introduced in 2.6. If I rollback new behaviour with this line in application.conf:

```auto
akka.actor.internal-dispatcher = akka.actor.default-dispatcher

```

deadlock seems to be gone away.  
My question is why this happens. It would be fine if my code may not work while internal and default dispatcher were the same, but this situation is directly opposite.
