Add 'good vs bad' trace for shaky test -- and solve it#54
Conversation
|
I think it would be worth checking the equivalent generated C# source for any uses of "volatile" or other synchronization primitives - it's likely we have a race condition somewhere |
|
Apparently can also raise the following error for test |
Thanks, that's a good suggestion. I'll have a look. These tests use mutable state with |
|
Improved on the minimal repro. This now always fails. Also, we've now shown it is NOT a race condition: [<Fact>]
let ``Crash Empty TaskSeq with NRE``() = task {
let tskSeq = taskSeq {
do! Task.Delay(50) |> Task.ofTask
// adding any kind of yield and the problem disappears:
//yield 10
}
use enumerator1 = tskSeq.GetAsyncEnumerator()
let! (hasNext: bool) = enumerator1.MoveNextAsync()
use enumerator1 = tskSeq.GetAsyncEnumerator()
let! (hasNext: bool) = enumerator1.MoveNextAsync()
let! (hasNext: bool) = enumerator1.MoveNextAsync() // this ALWAYS throws |
c355e4d to
fa86b29
Compare
fa86b29 to
90e20b4
Compare
5594239 to
8d67c15
Compare
|
Solution: set the See in particular this commit: #d5d49df.
For posterity: it turned out to be a missed scenario for the special case of awaited tasks in empty sequences. There was no race condition. |
3f739a1 to
0e9b648
Compare
0e9b648 to
82028a8
Compare
The following test may fail from time to time. It's unclear what the exact conditions are for failing it consistently:
It fail, among others, with input like the following (it's variant
DelayDoBang):In this branch's first commit there's a
TRACE_FAILand aTRACE_SUCCESSfor comparison. It appears thatcompletedflag isn't set consistently.