Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uprunBlockingTest fails with "This job has not completed yet" #1204
Comments
This comment has been minimized.
This comment has been minimized.
Thank you for this minimal repro bug report! Adding some tests for this and taking a look at getting this patched. |
This comment has been minimized.
This comment has been minimized.
as an aside if anyone else is seeing this until it gets fixed - it appears the failure is caused by the thread (the blocking call to sleep is not required) |
This comment has been minimized.
This comment has been minimized.
Patch #1206 should fix it! It turns out the behavior of completion in the presence of multiple threads had a non-deterministic outcome that could, in some cases, cause a random test result. This patch fixes the issue reported here by making it pass (as expected) while providing a detailed error message and test failure if this race condition is detected. |
…is fixed / Kotlin/kotlinx.coroutines#1206 merged and both released
This comment has been minimized.
This comment has been minimized.
Is there a workaround for this issue ? |
This comment has been minimized.
This comment has been minimized.
I came with this exception for some Room database tests (
I hope this helps! |
This comment has been minimized.
This comment has been minimized.
I'm using something like
|
This comment has been minimized.
This comment has been minimized.
@objcode I'm not sure if this patch will fix this issue entirely. E.g. this code, that uses no other threads, fails with the "This job has not completed" message"
while this code just finishes without any problems:
|
This comment has been minimized.
This comment has been minimized.
@Anton-Spaans-Intrepid I would expect that to fail as it the collect {} will never complete. In the patched version, you should see a 30 second wait followed by an error. What behavior are you expecting? |
This comment has been minimized.
This comment has been minimized.
(I just discovered I used my other GitHub account ... ah well I expect the test to never end. It will hang. |
This comment has been minimized.
This comment has been minimized.
@streetsofboston Hm, interesting. Can you elaborate on why? To me this seems like it "should" fail since you're suspending the test coroutine (the coroutine in rbt) with There's probably three options:
|
This comment has been minimized.
This comment has been minimized.
@objcode
The above test would never return. You could make the case that if a non-suspending piece of code never completes, a corresponding suspending piece of code should never resume (and when wrapping that in a Also, a 30 seconds timeout may not be enough for some tests... should the timeout be configurable? In the end, it is a matter of taste |
This comment has been minimized.
This comment has been minimized.
Any update on when this fix will be released? |
This comment has been minimized.
This comment has been minimized.
Having this issue as well, Seems it only happens if touching files in android framework or that contain livedata not quite sure... |
This comment has been minimized.
This comment has been minimized.
Happens to my tests (not using livedata). Here are the tests: https://github.com/premnirmal/StockTicker/blob/master/app/src/test/kotlin/com/github/premnirmal/ticker/network/StocksApiTest.kt |
This simple block:
Fails with the exception:
This looks like a bug to me as it should pass.
Kotlin 1.3.31
Coroutines 1.2.1