Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.43 KB

2016-10-03-monix-v2.0.3.md

File metadata and controls

42 lines (34 loc) · 1.43 KB
layout title author excerpt_separator description
post
Monix: Version 2.0.3 Released for Bug Fixing
alexelcu
<!--more-->

This release is binary compatible with 2.0.x, being a bug fix release release for Issue #230: Deadlocks when blocking threads due to LocalBatchingExecutor (affects Task usage).

Basically the implementation of LocalBatchingExecutor assumed that the given LocalRunnable instances will not block the current thread. However there are clearly cases in which users and up blocking during a LocalRunnable. For example:

val source1 = Task(100)
val source2 = Task(200).onErrorHandleWith { case e: Exception => Task.raiseError(e) }

val derived = source1.map { x =>
  val r = Await.result(source2.runAsync, 10.seconds)
  r + x
}

val result = Await.result(derived.runAsync, 10.seconds)

This is clearly not idiomatic usage because blocking threads is evil, however it does happen in code and it has to work. As can be seen in the committed fix the JVM-specific implementation for the LocalBatchingExecutor now uses Scala's BlockContext to workaround this limitation of our local trampoline.

Enjoy!