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

[release-1.10] Backports #235

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ on:
pull_request:
branches:
- master
- release-1.4
- release-*
push:
branches:
- master
- release-1.4
- release-*
tags: '*'
jobs:
test:
Expand All @@ -18,6 +18,7 @@ jobs:
matrix:
version:
- '1.3'
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia.
- 'nightly'
os:
Expand All @@ -31,22 +32,15 @@ jobs:
exclude:
- os: macOS-latest
arch: x86
- os: windows-latest
version: '1.3' # `curl_easy_setopt: 48` error on github CI
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-${{ matrix.os }}
${{ runner.os }}-
- uses: julia-actions/cache@v1
- run: julia --color=yes .ci/test_and_change_uuid.jl
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
Expand Down
1 change: 1 addition & 0 deletions src/Curl/Curl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export
add_handle,
remove_handle

using Base: @lock
using LibCURL
using LibCURL: curl_off_t, libcurl
# not exported: https://github.com/JuliaWeb/LibCURL.jl/issues/87
Expand Down
13 changes: 13 additions & 0 deletions src/Curl/Multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
function Multi(grace::Integer = typemax(UInt64))
multi = new(ReentrantLock(), C_NULL, nothing, Easy[], grace)
finalizer(done!, multi)
@lock MULTIS_LOCK push!(filter!(m -> m.value isa Multi, MULTIS), WeakRef(multi))
return multi
end
end
Expand Down Expand Up @@ -52,6 +53,18 @@
end
end

const MULTIS_LOCK = Base.ReentrantLock()
const MULTIS = WeakRef[]
# Close any Multis and their timers at exit that haven't been finalized by then
Base.atexit() do
while true
w = @lock MULTIS_LOCK (isempty(MULTIS) ? nothing : pop!(MULTIS))
w === nothing && break
w = w.value
w isa Multi && done!(w)
end

Check warning on line 65 in src/Curl/Multi.jl

View check run for this annotation

Codecov / codecov/patch

src/Curl/Multi.jl#L60-L65

Added lines #L60 - L65 were not covered by tests
end

function remove_handle(multi::Multi, easy::Easy)
lock(multi.lock) do
@check curl_multi_remove_handle(multi.handle, easy.handle)
Expand Down
5 changes: 1 addition & 4 deletions src/Downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,8 @@ end

# Precompile
let
d = Downloader(; grace=0.01)
d = Downloader()
download("file://" * @__FILE__; downloader=d)
# Ref https://github.com/JuliaLang/julia/issues/49513
# we wait for the grace task to finish
sleep(0.05)
precompile(Tuple{typeof(Downloads.download), String, String})
precompile(Tuple{typeof(Downloads.Curl.status_2xx_ok), Int64})
end
Expand Down
Loading