Skip to content
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

Sync develop with parent project #2

Merged
merged 168 commits into from
Mar 18, 2020
Merged

Conversation

circusmagnus
Copy link
Owner

No description provided.

robxyy and others added 30 commits September 10, 2019 15:06
The naming for this convenience function is inspired by Continuation.resumeWith.
* onSend/onReceive clauses on the same channel: Instead of
  StackOverflowError we throw IllegalStateException and leave
  the channel in the original state.
* Fix SOE in select with "opposite channels" stress-test. The fix is
  based on the sequential numbering of atomic select operation.
  Deadlock is detected and the operation with the lower sequential
  number is aborted and restarted (with a larger number).

Fixes #504
Fixes #1411
In preparation to native multithreading.
This should prevent successful casts to type SettableFuture, meaning
client code can't access and complete the internal Future without
resorting to reflection..
    * Remove obsolete rx-example module
    * Properly document interoperability with Reactor context
    * Update reactive readme
…els (#1534)


  * Average performance improvement is around 25%
  * API is internal and targeted to specific usage
  * DispatchedTask and DispatchedContinuation are extracted to separate files for better readability and maintainability
  * Ensure ConsumeAsFlow does not retain reference to the last element of the flow with test
# Conflicts:
#	reactive/kotlinx-coroutines-reactive/src/Channel.kt
#	reactive/kotlinx-coroutines-rx2/src/RxChannel.kt
* ./gradlew :kotlinx-coroutines-core:jvmTest
  becomes really fast, since it does not run any stress tests.
* ./gradlew build
  still runs all the tests.
This bug was introduced by #1524. The crux of problem is that
TryOffer/PollDesc.onPrepare method is no longer allowed to update
fields in these classes (like "resumeToken" and "pollResult") after call
to tryResumeSend/Receive method, because the latter will complete
the ongoing atomic operation and helper method might find it complete
and try reading "resumeToken" which was not initialized yet.

This change removes "pollResult" field which was not really needed
("result.pollResult" field is used) and removes "resumeToken" by
exploiting the fact that current implementation of
CancellableContinuationImpl does not need a token anymore. However,
CancellableContinuation.tryResume/completeResume ABI is left intact,
because it is used by 3rd party code.

This fix lead to overall simplification of the code. A number of fields
and an auxiliary IdempotentTokenValue class are removed, tokens used to
indicate various results are consolidated, so that resume success
is now consistently indicated by a single RESUME_TOKEN symbol.

Fixes #1561
Was failing with java.lang.AssertionError
	at kotlinx.coroutines.channels.SendElement.tryResumeSend(AbstractChannel.kt:1055)
	at kotlinx.coroutines.channels.AbstractChannel.pollInternal(AbstractChannel.kt:510)
	at kotlinx.coroutines.channels.AbstractChannel.receive(AbstractChannel.kt:548)
This bug was introduced by PR #1524. It was reproducing when there
is a regular "send" operation on one side of a channel and
"select { onReceive }" on another side of the channel and the
"send" coroutine gets cancelled. The problem is that
SendElement.tryResumeSend implementation was calling finishPrepare
before it has successfully resumed continuation, so if that
continuation was already cancelled, the code in "finishPrepare" had
already stored the wrong affected node which it would later try to
call "completeResume" on.

This patch also adds hexAddress to the debug toString method of
all internal node classes in channel implementation.

Fixes #1588
Calls of afterCompletionInternal are pulled up the call stack. This
is very important, since scoped coroutines do "uCont.resumeWith" from
afterCompletionInternal, which makes all the JVM method visible in the
debugger call frames and in exceptions.

Additionally, this allows for some simplification of the JobSupport
code, as a number of methods do not need "mode" parameter anymore.
Moreover, the kludge of MODE_IGNORE is no longer needed and is
dropped.

Make TimeoutCoroutine extends ScopedCoroutines.

Fixes #1574
qwwdfsad and others added 29 commits March 4, 2020 23:33
…st (#1845)

* The problem was introduced by #1565. When doing concurrent add+removeFirst the following can happen:
  - "add" completes, but has not correct prev pointer in next node yet
  - "removeFirst" removes freshly added element
  - "add" performs "finishAdd" that adjust prev pointer of the next node and thus removed element is pointed from the list again
* A separate LockFreeLinkedListAddRemoveStressTest is added that reproduces this problem.
* The old LockFreeLinkedListAtomicLFStressTest is refactored a bit.
It doesn't work properly with new JS IR BE because it depends on a really old plugin version
Detect suspendCancellableCoroutine right after suspendCancellableCoroutineReusable within the same state machine and properly cleanup its child handle when its block completes

Fixes #1855
* Enable JS IR backend
* Workaround resolving Gradle metadata in kotlin2js plugin

Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
* Speed-up installed debug probes by splitting global probes lock to RW-lock, guard all state transitions with read lock and all read operations with write lock to guarantee a consistent snapshot
* Prevent IllegalStateException during 'kill -5' command
* Introduce flag to disable creation stacktrace capturing in DebugProbes
* Support proposed changes in JUnit4 rules

Fixes #1379
Fixes #1372
Co-authored-by: Francesco Vasco <fsco_v-github@yahoo.it>
Fixes #1402

Co-authored-by: Francesco Vasco <fsco_v-github@yahoo.it>
JDK9 Flow integration is implemented as thin
wrappers around the Reactive Streams integration.
There was a small mistake in the Readme of kotlinx-coroutines-test. A lateinit variable evaluated to null at the beginning.
…roperly work on Android <= 6.0 that had a bug on a code-path with an empty stacktrace

Fixes #1866
…roperly work on Android <= 6.0 that had a bug on a code-path with an empty stacktrace (#1868)

Fixes #1866
* ReceiveChannel.broadcast shall start lazy coroutine when closed
* Documentation on broadcast operators is added that explains that the resulting BroadcastChannel shall be cancelled if it is not needed anymore.
* The only functional change is that closing a broadcast channel for lazy coroutine shall start the corresponding coroutine to give it a chance to promptly fail.
*  Also fix the order of events in lazy actor to be consistent with a broadcast channel

Fixes #1713
* BlockHound integration for Dispatchers.Default and Dispatchers.IO
* Use JNA-based self-attach mechanism in order to workaround a problem when tools.jar is loader by multiple classloaders
* publication-validator is renamed to integration-testing;
* Each test is now in a separate source set, which allows for more
  flexibility in their configuration; for example, failing to set
  `dryRun=true` doesn't prevent tests other than NPM to run, and
  it is possible to run the tests (and their dependencies)
  separately.
* Add an integration test for coroutine debugger java agent

Fixes #1060
Fixes #1031

Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
* Flow firstOrNull support

Co-authored-by: Bradyn Poulsen <bradyn@bradynpoulsen.com>
@circusmagnus circusmagnus merged commit c0bf01b into circusmagnus:develop Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.