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

Provide an error message if LD_PRELOAD is set during a Julia build or startup #55487

Open
wsmoses opened this issue Aug 13, 2024 · 15 comments
Open
Labels
building Build system, or building Julia or its dependencies system:linux Affects only Linux

Comments

@wsmoses
Copy link
Contributor

wsmoses commented Aug 13, 2024

This was a build of release-1.10.

[119298] signal (6.-6): Aborted
in expression starting at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Downloads.jl:469
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7fed8bd1b26d)
unknown function (ip: 0x7fed8bd232fb)
unknown function (ip: 0x7fed8bd24f9f)
Curl_parsenetrc at /home/wmoses/julia/usr/bin/../lib/libcurl.so.4 (unknown line)
Curl_connect at /home/wmoses/julia/usr/bin/../lib/libcurl.so.4 (unknown line)
multi_runsingle at /home/wmoses/julia/usr/bin/../lib/libcurl.so.4 (unknown line)
multi_socket at /home/wmoses/julia/usr/bin/../lib/libcurl.so.4 (unknown line)
curl_multi_socket_action at /home/wmoses/julia/usr/bin/../lib/libcurl.so.4 (unknown line)
curl_multi_socket_action at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/Curl.jl:51 [inlined]
curl_multi_socket_action at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/Curl.jl:59 [inlined]
macro expansion at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/utils.jl:56 [inlined]
do_multi at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/Multi.jl:129
#48 at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/Multi.jl:147 [inlined]
lock at ./lock.jl:229
#47 at /home/wmoses/julia/usr/share/julia/stdlib/v1.10/Downloads/src/Curl/Multi.jl:144 [inlined]
#726 at ./asyncevent.jl:306
unknown function (ip: 0x7fed7181c392)
_jl_invoke at /home/wmoses/julia/src/gf.c:2895 [inlined]
ijl_apply_generic at /home/wmoses/julia/src/gf.c:3077
jl_apply at /home/wmoses/julia/src/julia.h:1982 [inlined]
start_task at /home/wmoses/julia/src/task.c:1238
Allocations: 77961049 (Pool: 77879838; Big: 81211); GC: 96
Aborted (core dumped)
*** This error might be fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [sysimage.mk:67: /home/wmoses/julia/usr/lib/julia/sys.ji] Error 1
make: *** [Makefile:101: julia-sysimg-ji] Error 2

The same error occurs on my system using juliaup binaries for 1.10, 1.9, and 1.11-rc2

@giordano
Copy link
Contributor

Can you please provide more information about the system? CPU, operating system, etc... What are make options? Just default configuration?

The same error occurs on my system using juliaup binaries for 1.10, 1.9, and 1.11-rc2

Just to understand, how do you reproduce the same error when you're using prebuilt binaries?

@ViralBShah
Copy link
Member

Is there an LD_LIBRARY_PATH or LD_PRELOAD by any chance that is loading something else?

@wsmoses
Copy link
Contributor Author

wsmoses commented Aug 14, 2024

yeah I think its an ld_preload setting the allocator to libtcmalloc

@giordano
Copy link
Contributor

For future reference, this is probably related to #44242 and #48461 (which was also worked around by unsetting LD_PRELOAD)

@ViralBShah
Copy link
Member

Please reopen if still an issue. We may want to check the existence of LD_PRELOAD and LD_LIBRARY_PATH in our build to warn users.

@moble
Copy link
Contributor

moble commented Sep 10, 2024

@ViralBShah I think this is very much still an issue. One of my users ran into this problem (with jemalloc, on a cluster I couldn't access), and it took us forever to diagnose. Some sort of warning would have saved us a lot of time.

Unfortunately for this user, just unsetting LD_PRELOAD isn't an option, because he needs to call Julia from another program that does actually need jemalloc. But knowing that earlier would have been very helpful. I'm hoping that building Julia from scratch lets him avoid the problem. 🤞

@ViralBShah ViralBShah changed the title Julia fails to build on a clean system due to memory error (in curl?) Provide an error message if LD_PRELOAD is set during a Julia build or startup Sep 10, 2024
@ViralBShah
Copy link
Member

I am not sure how far you'll get with jemalloc even with a source build: #46298

But reopening this issue to have a warning if LD_PRELOAD is set at build or run time.

@ViralBShah ViralBShah reopened this Sep 10, 2024
@giordano
Copy link
Contributor

Note that LD_PRELOAD can also be used "safely", for example for profiling, and MPI.jl explicitly supports that: JuliaParallel/MPI.jl#451. So I'm a bit wary of adding a warning.

@ViralBShah
Copy link
Member

I was thinking that the message would say something along the lines of: "LD_PRELOAD has been set to $val. If you experience problems with your build or at runtime, please review".

@maleadt
Copy link
Member

maleadt commented Sep 10, 2024

Also note that LD_PRELOAD is already shown by the Environment: section in versioninfo(), so there's some visibility already:

function is_nonverbose_env(k::String)
return occursin(r"^JULIA_|^DYLD_|^LD_", k)
end

@ufechner7
Copy link

But that does not help if Julia doesn't start at all.

@giordano
Copy link
Contributor

If Julia doesn't start at all it probably doesn't have any chance to print anything because it dies too early.

@oscardssmith
Copy link
Member

Can we not intercept the signal handler to print a brief something on the C level?

@IanButterworth
Copy link
Member

If there isn't a good option in julia perhaps juliaup could warn?

@moble
Copy link
Contributor

moble commented Sep 11, 2024

But that does not help if Julia doesn't start at all.

Fair enough, but evidently for several cases, Julia does start just fine. In the example I ran into, the error only occurred after Pkg had been loaded and started trying to curl something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies system:linux Affects only Linux
Projects
None yet
Development

No branches or pull requests

8 participants