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

Downloads.download prints Unhandled Task ERROR: StackOverflowError: and then hangs indefinitely #163

Closed
DilumAluthge opened this issue Nov 5, 2021 · 2 comments · Fixed by #164
Labels
bug Something isn't working

Comments

@DilumAluthge
Copy link
Member

When running the generate_historical_stdlibs.jl script, I get Unhandled Task ERROR: StackOverflowError:, and then it hangs indefinitely.

Here are the steps to reproduce under rr:

git clone https://github.com/JuliaLang/Pkg.jl.git
cd Pkg.jl
wget https://raw.githubusercontent.com/JuliaLang/julia/master/.buildkite/utilities/rr/rr_capture.jl
export JULIA_DEPOT_PATH=$(mktemp -d)
export JULIA_PROJECT="ext/HistoricaStdlibGenerator"
julia -e 'import Pkg; Pkg.instantiate()'
export JULIA_TEST_RR_TIMEOUT=10 # 10 minutes
while julia rr_capture.jl julia ext/HistoricaStdlibGenerator/generate_historical_stdlibs.jl; do :; done

Here's the error:

rr: Saving execution to trace directory `/home/dilum/Desktop/Pkg.jl/temp_for_rr/jl_ebxdQF/rr_traces/julia-0'.
[ Info: Downloading versions.json...
[ Info: Identified 25 versions to try...
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.0-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.1-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.2-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.3-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.4-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.5-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.0-linux-x86_64.tar.gz
[ Info: Downloading https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.1-linux-x86_64.tar.gz
Unhandled Task ERROR: StackOverflowError:


Process timed out (with a timeout of 10 minutes). Signalling `rr` for force-cleanup!
`rr` returned 0, packing and uploading traces...
rr: Packed trace directory `/home/dilum/Desktop/Pkg.jl/temp_for_rr/jl_ebxdQF/rr_traces/julia-0'.
Read : 443 MB ==> 38%[ Info: The `rr` trace file has been saved to: /home/dilum/Desktop/Pkg.jl/dumps/rr--build_----commit_--2021_11_05_11_26_00.tar.zst
/*stdin*\            : 39.97%   (482458112 => 192818618 bytes, /home/dilum/Desktop/Pkg.jl/dumps/rr--build_----commit_--2021_11_05_11_26_00.tar.zst)
[ Info: Finished running the command under rr
┌ Info:
│   process.exitcode = 0
└   process.termsignal = 15

I have the rr trace. Let me know if you want me to send it to you.

@DilumAluthge DilumAluthge added the bug Something isn't working label Nov 5, 2021
@StefanKarpinski
Copy link
Sponsor Member

@vtjnash, would you mind taking a look at this since I doubt I'll be able to make heads or tails of it.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 8, 2021

Looks like a Multi.jl usage error. Also, perhaps you're supposed to call Curl_set_in_callback inside any callbacks?

...
#46 0x00007f5365f05360 in jfptr_timer_callback_18799.clone_1 () at channels.jl:331
#47 0x00007f537a13aa0a in _jl_invoke (world=31709, mfunc=<optimized out>, nargs=3, args=0x7f5310665330, F=0x7f53671fdcf0 <jl_system_image_data+10021424>)
    at /buildworker/worker/package_linux64/build/src/gf.c:2256
#48 ijl_apply_generic (F=<optimized out>, args=0x7f5310665330, nargs=<optimized out>) at /buildworker/worker/package_linux64/build/src/gf.c:2438
#49 0x00007f536592677f in jlcapi_timer_callback_18888.clone_1 () at locks-mt.jl:90
#50 0x00007f531edf074c in Curl_update_timer () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#51 0x00007f531edf2a0e in curl_multi_socket_action () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#52 0x00007f5365f00fea in curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:47
#53 curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:55
#54 macro expansion () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/utils.jl:28
#55 japi1_do_multi_18962 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:114
#56 0x00007f5365f051b3 in julia_timer_callback_18798 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:127
#57 0x00007f5365f05360 in jfptr_timer_callback_18799.clone_1 () at channels.jl:331
#58 0x00007f537a13aa0a in _jl_invoke (world=31709, mfunc=<optimized out>, nargs=3, args=0x7f53106656b0, F=0x7f53671fdcf0 <jl_system_image_data+10021424>)
    at /buildworker/worker/package_linux64/build/src/gf.c:2256
#59 ijl_apply_generic (F=<optimized out>, args=0x7f53106656b0, nargs=<optimized out>) at /buildworker/worker/package_linux64/build/src/gf.c:2438
#60 0x00007f536592677f in jlcapi_timer_callback_18888.clone_1 () at locks-mt.jl:90
#61 0x00007f531edf074c in Curl_update_timer () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#62 0x00007f531edf2a0e in curl_multi_socket_action () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#63 0x00007f5365f00fea in curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:47
#64 curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:55
#65 macro expansion () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/utils.jl:28
#66 japi1_do_multi_18962 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:114
#67 0x00007f5365f051b3 in julia_timer_callback_18798 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:127
#68 0x00007f5365f05360 in jfptr_timer_callback_18799.clone_1 () at channels.jl:331
#69 0x00007f537a13aa0a in _jl_invoke (world=31709, mfunc=<optimized out>, nargs=3, args=0x7f5310665a30, F=0x7f53671fdcf0 <jl_system_image_data+10021424>)
    at /buildworker/worker/package_linux64/build/src/gf.c:2256
#70 ijl_apply_generic (F=<optimized out>, args=0x7f5310665a30, nargs=<optimized out>) at /buildworker/worker/package_linux64/build/src/gf.c:2438
#71 0x00007f536592677f in jlcapi_timer_callback_18888.clone_1 () at locks-mt.jl:90
#72 0x00007f531edf074c in Curl_update_timer () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#73 0x00007f531edf2a0e in curl_multi_socket_action () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#74 0x00007f5365f00fea in curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:47
#75 curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:55
#76 macro expansion () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/utils.jl:28
#77 japi1_do_multi_18962 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:114
#78 0x00007f5365f051b3 in julia_timer_callback_18798 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:127
#79 0x00007f5365f05360 in jfptr_timer_callback_18799.clone_1 () at channels.jl:331
#80 0x00007f537a13aa0a in _jl_invoke (world=31709, mfunc=<optimized out>, nargs=3, args=0x7f5310665db0, F=0x7f53671fdcf0 <jl_system_image_data+10021424>)
    at /buildworker/worker/package_linux64/build/src/gf.c:2256
#81 ijl_apply_generic (F=<optimized out>, args=0x7f5310665db0, nargs=<optimized out>) at /buildworker/worker/package_linux64/build/src/gf.c:2438
#82 0x00007f536592677f in jlcapi_timer_callback_18888.clone_1 () at locks-mt.jl:90
#83 0x00007f531edf074c in Curl_update_timer () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#84 0x00007f531edf2a0e in curl_multi_socket_action () from target:/home/dilum/.asdf/installs/julia/nightly/bin/../lib/julia/libcurl.so
#85 0x00007f5365f00fea in curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:47
#86 curl_multi_socket_action () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Curl.jl:55
#87 macro expansion () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/utils.jl:28
#88 japi1_do_multi_18962 () at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.8/Downloads/src/Curl/Multi.jl:114
...

Correct usage is exemplified here: https://github.com/curl/curl/blob/master/docs/examples/multi-uv.c#L165-L167
I'll make a PR to make this repo match the example.

vtjnash added a commit that referenced this issue Nov 8, 2021
StefanKarpinski pushed a commit that referenced this issue Nov 9, 2021
ericphanson pushed a commit to ericphanson/Downloads.jl that referenced this issue Jan 26, 2022
ericphanson pushed a commit to ericphanson/Downloads.jl that referenced this issue Jan 27, 2022
DilumAluthge added a commit that referenced this issue Mar 3, 2022
* Before building and testing the package, make sure that the UUID has not been edited (#128)

(cherry picked from commit 21843d0)

* CI: Standardize the workflow for testing and changing the UUID (#129)

(cherry picked from commit cd002c3)

* fix #131 and add test (#132)

(cherry picked from commit adbb974)

* Improve inferability of download() (#133)

(cherry picked from commit 848d374)

* fix ci badge (#137)

(cherry picked from commit 3870614)

* Fix a handful of invalidations in expression-checking (#138)

ChainRulesCore defines `==(a, b::AbstractThunk)` and its converse,
and this invalidates a couple of poorly-typed Symbol checks.
This more "SSA-like" way of writing the code is easier to infer.

(cherry picked from commit 25f7af3)

* tests: skip wrong host test for SSL_NO_VERIFY (fix #139) (#140)

Since #114, we only turn
off peer verification, not host verification when the `SSL_NO_VERIFY`
variables are set. This means that the last set of tests in the "SSL no
verify override" testset *should* fail for `wrong.host.badssl.com`. That
is not what I was seeing, however — the test was still passing — which I
found puzzling but just moved on with my life at the time. It turns out
that the test *does* fail if libcurl is build with OpenSSL. Since
whether the test passes or not for that host depends on how things are
built, this change simply skips the test (by popping the URL from the
set of tested URLS for that testset).

The tests above that which use the easy hook mechanism are fixed in a
different way: for those I made the hook disable both host and peer
verification, which should fix the tests for any bad host including when
the server sends the wrong host name.

(cherry picked from commit e22219f)

* Fix input body size detection for IOBuffer(codeunits(str)) (#143)

Somewhat surprisingly, the type of this is not IOBuffer, but a related
type (Base.GenericIOBuffer{Base.CodeUnits{UInt8, String}}).

(cherry picked from commit 470b7f0)

* Typo fix: indiation -> indication (#144)

(cherry picked from commit 5f1509d)

* use Timer instead of libuv timer API

(cherry picked from commit 11493ff)

* use FDWatcher instead of libuv poll API

(cherry picked from commit 4c1d2af)

* fix wrong definition of curl_socket_t on Windows

(cherry picked from commit 2eb0491)

* Revert "stop using raw libuv API" (#156)

(cherry picked from commit c91876a)

* Revert "Revert "stop using raw libuv API" (#156)"

This reverts commit c91876a.

(cherry picked from commit 69acc13)

* add missing locks during Timer callbacks

(cherry picked from commit 43a3484)

* fix Timer usage (#158)

(cherry picked from commit 62b497e)

* Workaround for missing isopen check in FDWatcher (#161)

(possible multithread race with this still needs to be fixed)

(cherry picked from commit 7f91b8a)

* Check for timer isopen correctly (#162)

(cherry picked from commit 4250b35)

* remove trailing whitespace

(cherry picked from commit d8c626b)

* Avoid infinite recursion in `timer_callback` (#164)

Fixes #163

(cherry picked from commit a55825b)

* should also look into headers for input_size (#167)

If no content length is set while uploading some contents, Curl defaults to use
chunked transfer encoding. In some cases we want to prevent that because the
server may not support chunked transfers.

With this change, the request method will also look at the headers while
determining the input size and if found call `set_upload_size` as usual. So to
switch off chunked transfers, one must also know and set the content length
header while invoking `download` or `request` methods.

(cherry picked from commit ab628ab)

* rename: singularize add_{upload,seek}_callback

These only add one callback so having them be plural is weird.

(cherry picked from commit 5bd0826)

* add support for setting a debug callback

(cherry picked from commit 55a0c39)

* end-to-end tests for #167

This adds end-to-end tests for the changes introduced in #167.

Verbose mode is switched off for these tests, but switching it on would show that not setting content-length headers results in chunked transfer encoding while setting it prevents that. Both tests should pass.

(cherry picked from commit 911368d)

* tests: use debug option to test for non/chunked uploads

This combines the functionality from the previous two commits to not
only trigger both chunked and non-chunked uploads, but also test for
that difference by capturing and inspecting the debug events.

(cherry picked from commit 4e0408a)

* bump patch

Co-authored-by: Dilum Aluthge <[email protected]>
Co-authored-by: Jakob Nybo Nissen <[email protected]>
Co-authored-by: Yuto Horikawa <[email protected]>
Co-authored-by: Tim Holy <[email protected]>
Co-authored-by: Stefan Karpinski <[email protected]>
Co-authored-by: Chris Foster <[email protected]>
Co-authored-by: Benoît Legat <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
Co-authored-by: Tanmay Mohapatra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants