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

Fix undefined current task variable from #42750 #42977

Closed
wants to merge 1 commit into from

Conversation

c42f
Copy link
Member

@c42f c42f commented Nov 6, 2021

This has caused flaky tests (presumably since #42750 was merged?). For example in

https://buildkite.com/julialang/julia-master/builds/5592#ecf7463c-ed99-41f5-be22-5b665f48c7a1

we have

Error During Test at /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Dates/test/types.jl:277
Test threw exception
Expression: timedwait((()->begin
              false
          end), Second(0); pollint = Millisecond(1)) === :timed_out
UndefVarError: ct not defined
Stacktrace:
 [1] _wait2(c::Base.GenericCondition{Base.Threads.SpinLock}, waiter::Task)
   @ Base ./condition.jl:91
 [2] Timer(cb::Base.var"#timercb#647"{Main.Test27Main_Dates_types.TypesTest.var"#1#2", Channel{Any}, Float64, UInt64}, timeout::Float64; interval::Float64)
   @ Base ./asyncevent.jl:265
 [3] timedwait(testcb::Main.Test27Main_Dates_types.TypesTest.var"#1#2", timeout::Float64; pollint::Float64)
   @ Base ./asyncevent.jl:305
 [4] #timedwait#2
   @ /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Dates/src/types.jl:479 [inlined]
 [5] macro expansion
   @ /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Test/src/Test.jl:479 [inlined]
 [6] macro expansion
   @ /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Dates/test/types.jl:277 [inlined]
 [7] macro expansion
   @ /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Test/src/Test.jl:1347 [inlined]
 [8] top-level scope
   @ /cache/build/amdci5-7/julialang/julia-master/julia-89e19a9c8c/share/julia/stdlib/v1.8/Dates/test/types.jl:277

I'm not sure how better to test this without calling _wait2 directly. Tests for Timer in channels.jl look like they should have covered it (without this they seem to hang on my machine).

@tkf
Copy link
Member

tkf commented Nov 7, 2021

How about #41833 (comment) ?

@c42f
Copy link
Member Author

c42f commented Nov 7, 2021

Using current_task() without a temporary makes this code the same as the two other places similar code occurs in task.jl.

(I looked at factoring these occurrences together, but the test isn't exactly the same in the three locations so I figured I'd just fix it in place.)

@tkf
Copy link
Member

tkf commented Nov 7, 2021

I see. Makes sense.

@tkf
Copy link
Member

tkf commented Nov 7, 2021

Then how about removing the line ct = current_task() in this PR then, so that the patch makes sense in isolation? (i.e., without referring to #41833 for why it's desirable)

@c42f
Copy link
Member Author

c42f commented Nov 7, 2021

Huh? I think this isn't really related to #41833 at all. It's fixing a separate bug introduced in #42750.

The only relation to #41833 is that there were spurious test failures there brought on by this bug.

@c42f
Copy link
Member Author

c42f commented Nov 7, 2021

Oh dear... I see I hit an implicit rebase conflict, and this should go into #41833 after all. Sorry for the noise.

@c42f c42f closed this Nov 7, 2021
@c42f c42f deleted the cjf/fix-condition-wait2 branch November 7, 2021 03:11
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.

2 participants