Skip to content

Version 1.3.3 #1703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 94 commits into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
c8a720a
Fixed linearizability of Channel.close operation
elizarov Sep 4, 2019
0bef2b9
Update example Android apps toolchain (AGP 3.5.0, AndroidX)
elizarov Sep 5, 2019
a2587d2
Robust waiting in CoroutinesDumpTest
elizarov Sep 5, 2019
007d8d7
Fixed completion sequence of ChannelLFStressTest
elizarov Sep 5, 2019
a7afd46
Improve docs / fix grammar
Inego Aug 5, 2019
489c9bb
Merge branch 'master' into develop
qwwdfsad Sep 10, 2019
d02febf
Fixes linearizability of Channel.close in advanced receive+send case
elizarov Sep 7, 2019
bf33052
Introduce InlineList to simplify helpClose logic, reverse helpClose r…
qwwdfsad Sep 9, 2019
89f8c69
Minor documentation improvements
qwwdfsad Sep 9, 2019
bda9c79
Update jmh-related plugins to be compatible with Gradle 5.5
qwwdfsad Sep 12, 2019
385d68c
Improve documentation of CompletableJob.completeExceptionally, add te…
qwwdfsad Sep 13, 2019
f62d35b
Properly handle null values in ListenableFuture
qwwdfsad Sep 13, 2019
3826ae5
Do not aggregate all coroutine info into a single string before dumpi…
qwwdfsad Sep 16, 2019
bd7c030
Optimize Flow.take (#1538)
qwwdfsad Sep 17, 2019
858094e
Eagerly create coroutine for lazily-started coroutine builders in ord…
qwwdfsad Sep 17, 2019
fcc004c
Install debug probes in CoroutinesTimeout constructor to capture coro…
qwwdfsad Sep 17, 2019
353510a
Make ReceiveChannel.cancel linearizability-friendly
qwwdfsad Sep 18, 2019
835ed4d
Promote reactive bridges for Flow to stable API (#1549)
qwwdfsad Sep 19, 2019
f0c2c5b
Add CompletableDeferred.completeWith(result: Result<T>)
glasser Sep 6, 2019
8e2a84d
Make Semaphore and Mutex stress tests concurrent
ndkoval Sep 21, 2019
3dbe82b
Fix StackOverflowException with select expressions
elizarov Aug 30, 2019
8f39109
Replace all volatiles with atomics in common code
elizarov Sep 24, 2019
ee04bd2
Hid the SettableFuture of future {}.
yorickhenning Sep 3, 2019
946e578
Introduce reusable cancellable continuations for hot loops with chann…
qwwdfsad Sep 25, 2019
84b24bd
Merge branch 'master' into develop
qwwdfsad Sep 25, 2019
fd27d55
Separate all JVM stress tests into a stressTest gradle task
elizarov Sep 25, 2019
2f8bff1
Fix race condition in pair select
elizarov Sep 22, 2019
f24b60c
Narrow down return type of tryResumeSend/Receive
elizarov Sep 26, 2019
1b0eca9
Fixed SendElement.tryResumeSend
elizarov Sep 27, 2019
216828a
Rename stressTest task to jvmStressTest to avoid conflict with prop
elizarov Sep 27, 2019
8fa07b5
Make `isStressTest` and the related properties top-level
ndkoval Sep 27, 2019
58bfd08
Fix ArrayChannel.isBufferEmpty atomicity
ndkoval Oct 1, 2019
8248fe4
Make MapTest - testErrorCancelsUpstream - actually test map operator
circusmagnus Oct 1, 2019
c5a42da
Migrate BOM module to java-platform plugin
Sep 22, 2019
cfc08ee
All ArrayChannel.size accesses should be under the channel lock
ndkoval Oct 2, 2019
d9d3574
Fix race in channel select/cancel
elizarov Oct 2, 2019
2fc00b8
Update atomicfu version
qwwdfsad Oct 4, 2019
ff9060c
Shorten resume call stack
elizarov Sep 25, 2019
5f2413a
Get rid of AbstractCoroutine.defaultResumeMode
elizarov Sep 26, 2019
3b2e437
Change stacktrace recovery contract
qwwdfsad Oct 3, 2019
ae57774
Eagerly create cancellation exception during Job.cancel call to make …
qwwdfsad Oct 4, 2019
7cc53d9
Typo in CoroutineScope's javadoc
OlegAndreych Oct 6, 2019
f86af23
Update coroutines builders kdocs to link to correct param
mareklangiewicz Oct 6, 2019
7f1a927
Attempt to select SelectInstance in onReceiveOrClosed before starting…
qwwdfsad Oct 8, 2019
38c3e9a
Recover stacktrace on the fast-path of receiveOrNull
qwwdfsad Oct 8, 2019
e2a72a0
Generalize onReceive* family implementation in channels, reduce bytec…
qwwdfsad Oct 9, 2019
a64e4da
Do not filter out stress tests from IDEA
qwwdfsad Oct 10, 2019
3816837
Remove duplicate js/npm folder
elizarov Oct 16, 2019
b7b5adb
Improve consumeAsFlow documentation
qwwdfsad Oct 9, 2019
e303e6b
Clarify difference between runBlocking and coroutineScope
qwwdfsad Oct 9, 2019
ef27ac3
Introduce Stream.consumeAsFlow
qwwdfsad Oct 9, 2019
bbf198b
Fix StackTraceRecoveryTest.testCancellableContinuation for 1.3.60
elizarov Oct 18, 2019
adb6164
Fix JobSupport comment about new state.
mareklangiewicz Oct 18, 2019
340d501
Optimize combine operator
qwwdfsad Oct 21, 2019
83943ef
Get rid of deprecated FlowCollector<*>.withContext
qwwdfsad Oct 22, 2019
6aedb61
Make TimeoutCancellationException copyable
qwwdfsad Oct 22, 2019
3affb90
Properly choose timeout exception with a recovered stacktrace to prov…
qwwdfsad Oct 22, 2019
ecbfa6d
Properly distinguish AbortFlowExceptions from different non-terminal …
qwwdfsad Oct 21, 2019
2ba1d98
Fix mapLatest documentation example
sebaslogen Oct 21, 2019
1a2707b
Cleanup CombineParametersTestBase
qwwdfsad Oct 28, 2019
9a2eb38
Add missing TestBase inheritance to fail on asynchronous errors
qwwdfsad Oct 29, 2019
1652bb9
Fix ReactorFlow integration bug exposed by TestBase
qwwdfsad Oct 29, 2019
1da7311
Restore AsyncJvmTest
qwwdfsad Nov 12, 2019
729dc5d
Gradle: Don't resolve classpath during configuration phase
elizarov Nov 19, 2019
1fd56f2
Properly support exception cause on JS and Native
elizarov Nov 20, 2019
7e895fc
Update Kotlin to 1.3.60
qwwdfsad Nov 22, 2019
3ab34d8
Support yield in immediate dispatchers
elizarov Nov 20, 2019
8f1f252
Avoid potential StackOverflow on wrapped UnconfinedDispatcher+yield
elizarov Nov 23, 2019
69d1d41
Optimize yield via dispatcher.isDispatchNeeded
elizarov Nov 26, 2019
ef199d1
Updated flow benchmark results to 1.3.60
elizarov Nov 28, 2019
445e026
Improve documentation
qwwdfsad Nov 25, 2019
391042f
Promote isDispatchNeeded to stable API
qwwdfsad Nov 26, 2019
bd1687f
Throw NoSuchElementException instead of UnsupportedOperationException…
qwwdfsad Nov 12, 2019
34dcfb1
Rethrow downstream exception during "onCompletion" emissions
qwwdfsad Nov 12, 2019
6c98c19
Update Kotlin to 1.3.61
qwwdfsad Dec 2, 2019
a930b0c
Consistently handle undeliverable exceptions in RxJava and Reactor in…
qwwdfsad Dec 5, 2019
c02648b
ContextScope.toString for better debuggability
qwwdfsad Dec 5, 2019
6cb317b
Better diagnostic exception message in MissingMainCoroutineDispatcher
qwwdfsad Dec 10, 2019
1b378ba
Introduce merge operator
qwwdfsad Dec 11, 2019
af9a201
Introduce DebugProbes.isInstalled method
qwwdfsad Dec 11, 2019
04e587c
Make sure that exception recovery does not break exception message
elizarov Dec 12, 2019
e60ec8e
User Class.forName instead of ServiceLoader to instantiate Dispatcher…
qwwdfsad Dec 12, 2019
5202a8b
Regroup benchmarks and adapt them to structured concurrency, cleanup …
qwwdfsad Sep 19, 2019
f27d176
CoroutineScheduler parking strategy rework
qwwdfsad Oct 1, 2019
4236c8c
New work stealing and unparking strategies
qwwdfsad Oct 10, 2019
ab30d72
New deterministic algorithm for working with blocking tasks
qwwdfsad Oct 17, 2019
d77c17c
Improve performance of task acquisition
qwwdfsad Nov 11, 2019
966020e
Document CoroutineScheduler machinery
qwwdfsad Nov 27, 2019
4dcfced
Ensure that interruption flag is cleaned up properly
qwwdfsad Dec 9, 2019
4224e01
Merge termination state machine and parking state machine into one, g…
qwwdfsad Dec 10, 2019
cbd5b1c
Merge pull request #1652 from Kotlin/scheduler-changes
qwwdfsad Dec 12, 2019
41dca58
Proguard rule to keep volatile name of SafeContinuation
elizarov Dec 12, 2019
7abce10
Merge branch 'master' into develop
qwwdfsad Dec 12, 2019
efc234f
Version 1.3.3
qwwdfsad Dec 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Change log for kotlinx.coroutines

## Version 1.3.3

### Flow
* `Flow.take` performance is significantly improved (#1538).
* `Flow.merge` operator (#1491).
* Reactive Flow adapters are promoted to stable API (#1549).
* Reusable cancellable continuations were introduced that improved the performance of various flow operators and iteration over channels (#1534).
* Fixed interaction of multiple flows with `take` operator (#1610).
* Throw `NoSuchElementException` instead of `UnsupportedOperationException` for empty `Flow` in `reduce` operator (#1659).
* `onCompletion` now rethrows downstream exceptions on emit attempt (#1654).
* Allow non-emitting `withContext` from `flow` builder (#1616).

### Debugging

* `DebugProbes.dumpCoroutines` is optimized to be able to print the 6-digit number of coroutines (#1535).
* Properly capture unstarted lazy coroutines in debugger (#1544).
* Capture coroutines launched from within a test constructor with `CoroutinesTimeout` test rule (#1542).
* Stacktraces of `Job`-related coroutine machinery are shortened and prettified (#1574).
* Stacktrace recovery unification that should provide a consistent experience recover of stacktrace (#1597).
* Stacktrace recovery for `withTimeout` is supported (#1625).
* Do not recover exception with a single `String` parameter constructor that is not a `message` (#1631).

### Other features

* `Dispatchers.Default` and `Dispatchers.IO` rework: CPU consumption is significantly lower, predictable idle threads termination (#840, #1046, #1286).
* Avoid `ServiceLoader` for loading `Dispatchers.Main` (#1572, #1557, #878, #1606).
* Consistently handle undeliverable exceptions in RxJava and Reactor integrations (#252, #1614).
* `yield` support in immediate dispatchers (#1474).
* `CompletableDeferred.completeWith(result: Result<T>)` is introduced.
* Added support for tvOS and watchOS-based Native targets (#1596).

### Bug fixes and improvements

* Kotlin version is updated to 1.3.61.
* `CoroutineDispatcher.isDispatchNeeded` is promoted to stable API (#1014).
* Livelock and stackoverflows in mutual `select` expressions are fixed (#1411, #504).
* Properly handle `null` values in `ListenableFuture` integration (#1510).
* Making ReceiveChannel.cancel linearizability-friendly.
* Linearizability of Channel.close in a complex contended cases (#1419).
* ArrayChannel.isBufferEmpty atomicity is fixed (#1526).
* Various documentation improvements.
* Reduced bytecode size of `kotlinx-coroutines-core`, reduced size of minified `dex` when using basic functionality of `kotlinx-coroutines`.

## Version 1.3.2

This is a maintenance release that does not include any new features or bug fixes.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.2)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.3) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.3)

Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
This is a companion version for Kotlin `1.3.50` release.
This is a companion version for Kotlin `1.3.61` release.

```kotlin
suspend fun main() = coroutineScope {
Expand Down Expand Up @@ -82,15 +82,15 @@ Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.3.50</kotlin.version>
<kotlin.version>1.3.61</kotlin.version>
</properties>
```

Expand All @@ -100,15 +100,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
}
```

And make sure that you use the latest Kotlin version:

```groovy
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
}
```

Expand All @@ -126,15 +126,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
}
```

And make sure that you use the latest Kotlin version:

```groovy
plugins {
kotlin("jvm") version "1.3.50"
kotlin("jvm") version "1.3.61"
}
```

Expand All @@ -145,7 +145,7 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
Core modules of `kotlinx.coroutines` are also available for
[Kotlin/JS](#js) and [Kotlin/Native](#native).
In common code that should get compiled for different platforms, add dependency to
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.2/jar)
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

### Android
Expand All @@ -154,7 +154,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
module as dependency when using `kotlinx.coroutines` on Android:

```groovy
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
```

This gives you access to Android [Dispatchers.Main]
Expand All @@ -173,15 +173,15 @@ R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default
### JS

[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.2/jar)
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

You can also use [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) package via NPM.

### Native

[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.2/jar)
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks

import kotlinx.coroutines.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package benchmarks

import benchmarks.actors.CORES_COUNT
import benchmarks.akka.CORES_COUNT
import kotlinx.coroutines.*
import kotlinx.coroutines.scheduling.*
import org.openjdk.jmh.annotations.Param
Expand All @@ -22,14 +22,14 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {

abstract var dispatcher: String
override lateinit var coroutineContext: CoroutineContext
var closeable: Closeable? = null
private var closeable: Closeable? = null

@UseExperimental(InternalCoroutinesApi::class)
@Setup
@UseExperimental(InternalCoroutinesApi::class)
open fun setup() {
coroutineContext = when {
dispatcher == "fjp" -> ForkJoinPool.commonPool().asCoroutineDispatcher()
dispatcher == "experimental" -> {
dispatcher == "scheduler" -> {
ExperimentalCoroutineDispatcher(CORES_COUNT).also { closeable = it }
}
dispatcher.startsWith("ftp") -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.actors
package benchmarks.akka

import akka.actor.ActorRef
import akka.actor.ActorSystem
Expand All @@ -13,7 +13,6 @@ import org.openjdk.jmh.annotations.*
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

const val N_MESSAGES = 100_000

Expand All @@ -29,12 +28,12 @@ class Stop
* PingPongAkkaBenchmark.singlePingPong default-dispatcher avgt 10 173.742 ± 41.984 ms/op
* PingPongAkkaBenchmark.singlePingPong single-thread-dispatcher avgt 10 24.181 ± 0.730 ms/op
*/
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
//@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
//@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
//@Fork(value = 2)
//@BenchmarkMode(Mode.AverageTime)
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
//@State(Scope.Benchmark)
open class PingPongAkkaBenchmark {

lateinit var system: ActorSystem
Expand Down Expand Up @@ -62,12 +61,12 @@ open class PingPongAkkaBenchmark {
Await.ready(system.terminate(), Duration.Inf())
}

@Benchmark
// @Benchmark
fun singlePingPong() {
runPingPongs(1)
}

@Benchmark
// @Benchmark
fun coresCountPingPongs() {
runPingPongs(Runtime.getRuntime().availableProcessors())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.actors
package benchmarks.akka

import akka.actor.ActorRef
import akka.actor.ActorSystem
Expand All @@ -14,7 +14,6 @@ import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.util.concurrent.CountDownLatch
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.TimeUnit

const val ROUNDS = 10_000
const val STATE_SIZE = 1024
Expand All @@ -38,12 +37,12 @@ val CORES_COUNT = Runtime.getRuntime().availableProcessors()
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor default-dispatcher avgt 14 39.964 ± 2.343 ms/op
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor single-thread-dispatcher avgt 14 10.214 ± 2.152 ms/op
*/
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
//@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
//@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
//@Fork(value = 2)
//@BenchmarkMode(Mode.AverageTime)
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
//@State(Scope.Benchmark)
open class StatefulActorAkkaBenchmark {

lateinit var system: ActorSystem
Expand Down Expand Up @@ -72,22 +71,22 @@ open class StatefulActorAkkaBenchmark {
Await.ready(system.terminate(), Duration.Inf())
}

@Benchmark
// @Benchmark
fun singleComputationSingleRequestor() {
run(1, 1)
}

@Benchmark
// @Benchmark
fun singleComputationMultipleRequestors() {
run(1, CORES_COUNT)
}

@Benchmark
// @Benchmark
fun multipleComputationsSingleRequestor() {
run(CORES_COUNT, 1)
}

@Benchmark
// @Benchmark
fun multipleComputationsMultipleRequestors() {
run(CORES_COUNT, CORES_COUNT)
}
Expand Down Expand Up @@ -120,7 +119,8 @@ open class StatefulActorAkkaBenchmark {

private fun createComputationActors(initLatch: CountDownLatch, count: Int): List<ActorRef> {
return (0 until count).map {
system.actorOf(Props.create(ComputationActor::class.java,
system.actorOf(Props.create(
ComputationActor::class.java,
LongArray(STATE_SIZE) { ThreadLocalRandom.current().nextLong(0, 100) }, initLatch)
.withDispatcher("akka.actor.$dispatcher"))
}
Expand Down
Loading