julia
julia copied to clipboard
Call `pthread_attr_init` in `jl_init_stack_limits`
#55515 seems to have introduced segfaults on FreeBSD during the atexit and ccall tests. Prior to that PR, we had been calling pthread_attr_init in jl_init_stack_limits on FreeBSD. According to the manual page for pthread_attr_get_np, it is "HIGHLY RECOMMENDED" to use pthread_attr_init to allocate storage. Might as well put it back then, and hopefully it'll fix the segfaults.
Looks like this indeed fixes the atexit segfaults on FreeBSD. The CI failures for the build on musl Linux and tests for Linux PowerPC, AArch64, and x86_64 with assertions are unrelated.
I don't know, should it? Doesn't seem to be required on Linux though it shouldn't hurt to call it.
It may cause a memory leak, since it fails to get destroyed
Doesn't it get destroyed here? https://github.com/JuliaLang/julia/blob/7d2a7de5839f3461bcb3b9f131f384f7fc041da5/src/init.c#L78
The second does, but not the first
I don't understand, I only see one pthread_attr_t being created in this function, line 68:
https://github.com/JuliaLang/julia/blob/7d2a7de5839f3461bcb3b9f131f384f7fc041da5/src/init.c#L50-L101
I still don't get why it shouldn't be called on Linux, but at any rate, I've moved the call to be FreeBSD only.
Quoth Jameson in Slack, "just merge." Okie dokie