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

macOS: workaround a dyld/libunwind deadlock issue since 12.1 #43701

Merged
merged 2 commits into from
Jan 13, 2022
Merged

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Jan 7, 2022

Apple reintroduced the old bug that we previously worked around in
fad04d3 with a similar patch to this.

Fixes #43578

@staticfloat
Copy link
Sponsor Member

Is there a minimal reproducer that I can send to Apple?

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 7, 2022

You can potentially just note that the documentation for these functions in libunwind implies it doesn't acquire a lock, and that dyld is now violating that: http:https://www.nongnu.org/libunwind/man/unw_step(3).html#section_4

@staticfloat
Copy link
Sponsor Member

Alright, I opened a feedback with Apple, we'll see if it goes anywhere.

@IanButterworth
Copy link
Sponsor Member

I can confirm that the MWE from #43578 is fixed

julia> @profile while true
          run(`pwd`)
       end
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
etc.

but stress testing it here made it deadlock with ^C and ^T not working

% JULIA_DEPOT_PATH=/tmp/5454 ./julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.0-DEV.1248 (2022-01-07)
 _/ |\__'_|_|_|\__'_|  |  jn/43578/a51e2d83c0 (fork: 1 commits, 0 days)
|__/                   |

julia> using Pkg, Profile

julia> @profile Pkg.add("PNGFiles")
  Installing known registries into `/tmp/5454`
    Updating registry at `/tmp/5454/registries/General.toml`
   Resolving package versions...


@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 10, 2022

with ^C and ^T not working

Good catch. That is a different (but closely related) bug.

@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Jan 10, 2022
@IanButterworth
Copy link
Sponsor Member

Unfortunately something's still deadlocking for me. This is stopped with 0% cpu.

julia> @profile Pkg.add("PNGFiles")
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`
Precompiling project...
  Progress [===>                                     ]  12/191
  ◑ SentinelArrays
  ✓ Calculus
  ✓ RoundingIntegers
  ◑ StaticArrays
  ✓ AbstractFFTs
  ✓ IndirectArrays
  ✓ ExprTools
  ✓ IteratorInterfaceExtensions
  ✓ TensorCore
  ✓ StatsAPI
  ✓ CEnum
  ◓ FixedPointNumbers
  ◓ FillArrays
  ✓ OpenLibm_jll
  ✓ InverseFunctions
  ◑ WoodburyMatrices
  ✓ CompilerSupportLibraries_jll
  ◐ MacroTools
  ◒ Preferences
  ◒ Parsers
  ◑ Compat
  ◑ Observables
  ◓ Requires
  ◒ DataValueInterfaces
  ◓ RealDot

@IanButterworth
Copy link
Sponsor Member

I've tried, but I can't get this to deadlock! Thanks @vtjnash !

Apple reintroduced the old bug that we previously worked around in
fad04d3 with a similar patch to this.

This is needed anywhere that we may attempt to stop threads.

Fixes #43578
…sue, since 12.1

Later, we should probably switch to using mach_exc_server generated from
`mig mach_exc.defs`.
@IanButterworth
Copy link
Sponsor Member

IanButterworth commented Jan 13, 2022

I just hit a similar repeatable deadlock on ubuntu on master

julia> import Pkg

julia> Pkg.update()
    Updating registry at `~/.julia/registries/PrivateRegistry`
    Updating git-repo `[email protected]:PrivateOrg/PrivateRegistry`
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`
        Info Some packages have new versions but cannot be upgraded. To see why use `status --outdated`

julia> using Profile

julia> @profile Pkg.update()
    Updating registry at `~/.julia/registries/PrivateRegistry`
    Updating git-repo `[email protected]:PrivateOrg/PrivateRegistry`
    Updating registry at `~/.julia/registries/General.toml`
┌ Error: Some registries failed to update:
│     — /home/ian/.julia/registries/PrivateRegistry — failed to fetch from repo
└ @ Pkg.Registry ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.8/Pkg/src/Registry/Registry.jl:446
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Note that PrivateRegistry is the only registry added via ssh

I added a debug print to that error throw

Error: Pkg.Types.PkgError("failed to fetch from [email protected]:PrivateOrg/PrivateRegistry, 
error: GitError(Code:ERROR, Class:SSH, Failed to retrieve list of SSH authentication 
methods: Error waiting on socket)"

@vtjnash vtjnash merged commit 1b33119 into master Jan 13, 2022
@vtjnash vtjnash deleted the jn/43578 branch January 13, 2022 17:13
@KristofferC KristofferC added backport 1.6 Change should be backported to release-1.6 backport 1.7 labels Jan 13, 2022
@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Jan 14, 2022
@KristofferC KristofferC mentioned this pull request Jan 20, 2022
23 tasks
@KristofferC KristofferC mentioned this pull request Feb 19, 2022
50 tasks
@KristofferC
Copy link
Sponsor Member

This requires a manual backport against backports-release-1.6.

@KristofferC KristofferC mentioned this pull request May 16, 2022
45 tasks
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile: @profile hanging on MacOS 12
6 participants