TimeZones.jl
TimeZones.jl copied to clipboard
Stochastic failure in thread-safety tests
Noticed this failure on "Julia 1.6 - windows-latest - x64". I'm not seeing the source of the failure so it seemed best to track this in an issue:
Testing Running tests...
[ Info: Installing 2016j tzdata region data
[ Info: Downloading Windows to POSIX timezone ID XML version: release-40
[ Info: Compiling Windows time zone name translation
[ Info: Running Thread Safety tests
Multithreaded TimeZone construction: Error During Test at D:\a\TimeZones.jl\TimeZones.jl\test\thread-safety.jl:65
Got exception outside of a @test
failed process: Process(`'C:\hostedtoolcache\windows\julia\1.6.6\x64\bin\julia.exe'-Cnative'-JC:\hostedtoolcache\windows\julia\1.6.6\x64\lib\julia\sys.dll'--depwarn=yes--check-bounds=yes-g1--code-coverage=user--color=yes--startup-file=no--proj-E"using TimeZones
using Test
[ Info: Installing 2016j tzdata region data
[ Info: Converting tz source files into TimeZone data
@assert Threads.nthreads() > 1 \"This system does not support multiple threads, so the thread-safety tests cannot be run.\"
@testset \"Multithreaded TimeZone brute force test\" begin
function create_zdt(year, month, day, tz_name)
ZonedDateTime(DateTime(year, month, day), TimeZone(tz_name))
end
function cycle_zdts()
return [
try
create_zdt(year, month, day, tz_name)
catch e
# Ignore ZonedDateTimes that aren't valid
e isa Union{ArgumentError,AmbiguousTimeError,NonExistentTimeError} || rethrow()
nothing
end
for year in 2000:2020
for month in 1:5
for day in 10:15
for tz_name in timezone_names()
]
end
outputs = Channel(Inf)
@sync begin
for _ in 1:15
Threads.@spawn begin
put!(outputs, cycle_zdts())
end
end
end
close(outputs)
tzs = collect(outputs)
# Test that every Task produced the same result
allsame(x) = all(y -> y == first(x), x)
@test allsame(tzs)
end
#----------------------------------------------------
@testset \"Interleaved compile() and TimeZone construction\" begin
@sync for i in 1:20
if (i % 5 == 0)
TimeZones.TZData.compile()
end
Threads.@spawn begin
TimeZone(\"US/Eastern\", TimeZones.Class(:LEGACY))
end
end
end
"`, ProcessExited(3221225477)) [3221225477]
Stacktrace:
[1] pipeline_error
@ .\process.jl:538 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base.\process.jl:453
[3] run
@ .\process.jl:451 [inlined]
[4] (::var"#173#174")()
@ MainD:\a\TimeZones.jl\TimeZones.jl\test\thread-safety.jl:70
[5] withenv(f::var"#173#174", keyvals::Pair{String, Int64})
@ Base.\env.jl:161
[6] macro expansion
@ D:\a\TimeZones.jl\TimeZones.jl\test\thread-safety.jl:69 [inlined]
[7] macro expansion
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Test\src\Test.jl:1151 [inlined]
[8] top-level scope
@ D:\a\TimeZones.jl\TimeZones.jl\test\thread-safety.jl:67
[9] include(fname::String)
@ Base.MainInclude.\client.jl:444
[10] macro expansion
@ D:\a\TimeZones.jl\TimeZones.jl\test\runtests.jl:71 [inlined]
[11] macro expansion
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Test\src\Test.jl:1151 [inlined]
[12] top-level scope
@ D:\a\TimeZones.jl\TimeZones.jl\test\runtests.jl:38
[13] include(fname::String)
@ Base.MainInclude.\client.jl:444
[14] top-level scope
@ none:6
[15] eval
@ .\boot.jl:360 [inlined]
[16] exec_options(opts::Base.JLOptions)
@ Base.\client.jl:261
[17] _start()
@ Base.\client.jl:485
[ Info: Compiling Windows time zone name translation
[ Info: Successfully built TimeZones
Test Summary: | Pass Error Broken Total
TimeZones | 1781 1 2 1784
IndexableGenerator | 9 9
Class | 30 30
tzdata_versions | 2 2
tzdata_latest_version | 4 4
tryparse_dayofmonth_function | 7 7
compile | 79 79
istimezone | 3 3
etcetera | 9 9
FixedTimeZone | 36 36
VariableTimeZone | 24 24
ZonedDateTime | 210 210
Exceptions | 3 3
ParseNextError | 8 8
lt_local / lt_utc | 12 12
transition_range | 20 20
StepRange{ZonedDateTime} | 18 18
Transitions I/O | 5 5
read_signature | 2 2
read_version | 5 5
combine_designations | 9 9
write_signature | 1 1
write_version | 5 5
write | 3 2 5
read_signature | 2 2
read_version | 2 2
read | 7 7
write_signature | 1 1
write_version | 3 3
write | 6 6
Construct ZonedDateTime / DateTime | 4 4
Construct Date / ZonedDateTime | 4 4
Construct Time | 3 3
now | 2 2
today | 2 2
todayat | 4 4
System TZ behaviour | No tests
localzone | 14 14
legacy time zones | 5 5
next_transition_instant | 12 12
show_next_transition | 10 10
parse | 5 5
tryparse | 2 2
parse components | 1 1
default format | 1 1
parse constructor | 6 6
_parsesub_tzabbr | 12 12
_parsesub_offset | 28 28
_parsesub_time | 3 3
_parsesub_tzdate | 56 56
_parsesub_tz | 40 40
ZonedDateTime plot recipe | 9 9
Multithreaded TimeZone construction | 1 1
build process | 15 15
ERROR: LoadError: Some tests did not pass: 1781 passed, 0 failed, 1 errored, 2 broken.
in expression starting at D:\a\TimeZones.jl\TimeZones.jl\test\runtests.jl:37
ERROR: Package TimeZones errored during testing
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.TypesC:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
[2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing)
@ Pkg.OperationsC:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Operations.jl:1708
[3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, kwargs::Base.Iterators.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
@ Pkg.APIC:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:343
[4] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:coverage, :julia_args), Tuple{Bool, Vector{String}}}})
@ Pkg.APIC:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:80
[5] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:coverage, :julia_args), Tuple{Bool, Vector{String}}}})
@ Pkg.APIC:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:96
[6] top-level scope
@ none:1
Error: Process completed with exit code 1.
– https://github.com/JuliaTime/TimeZones.jl/runs/7252748476?check_suite_focus=true
Failed on commit: https://github.com/JuliaTime/TimeZones.jl/pull/385/commits/46855088c42092cc8d68f0810059421a47b6e8a3
Saw this failure again in https://github.com/JuliaTime/TimeZones.jl/pull/384/commits/da91b27a01b1f396ecd4e1d70098ca2f6a16a983
These thread-safety tests were removed in #382