You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TIME_ZONE_CACHE is not currently thread safe, so parsing a TimeZone object via the following constructor is currently a race condition, and can lead to crashes and errors:
The cache either needs to be surrounded by a lock (though this would serialize all TimeZone constructors and probably be worse than having no cache at all), or replicated via thread-local caches.
I would probably suggest a thread-local cache? But interested in other ideas! :)
Maybe just something like this?:
const THREADLOCAL_TIME_ZONE_CACHES =Vector{Dict{String,Tuple{TimeZone,Class}}}()
functionTimeZone(str::AbstractString, mask::Class=Class(:DEFAULT))
tz, class =get!(THREADLOCAL_TIME_ZONE_CACHES[Threads.threadid()], str) doendendfunction__init__()
append!(THREADLOCAL_TIME_ZONE_CACHES, [Dict{String,Tuple{TimeZone,Class}}() for _ in1:Threads.nthreads()]
end
The text was updated successfully, but these errors were encountered:
The
TIME_ZONE_CACHE
is not currently thread safe, so parsing aTimeZone
object via the following constructor is currently a race condition, and can lead to crashes and errors:TimeZones.jl/src/types/timezone.jl
Line 1 in 906cea0
TimeZones.jl/src/types/timezone.jl
Lines 43 to 47 in 906cea0
The cache either needs to be surrounded by a lock (though this would serialize all TimeZone constructors and probably be worse than having no cache at all), or replicated via thread-local caches.
I would probably suggest a thread-local cache? But interested in other ideas! :)
Maybe just something like this?:
The text was updated successfully, but these errors were encountered: