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

jl_profile_atomic lock around jl_spawn to prevent macos profiling deadlock #43629

Closed

Conversation

IanButterworth
Copy link
Member

Fixes #43578

Thanks to @dnadlinger and @staticfloat for the pointers on this.

julia> using Profile

julia> @profile while true
              run(`pwd`)
              end
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
# runs continuously, and signal handling still works, unlike on master

@IanButterworth IanButterworth requested a review from vtjnash January 2, 2022 01:04
@IanButterworth IanButterworth changed the title jl_profile_atomic lock around jl_spawn to prevent macos deadlock jl_profile_atomic lock around jl_spawn to prevent macos profiling deadlock Jan 2, 2022
@IanButterworth
Copy link
Member Author

Maybe this is doing something bad.. I just tried ProfileView with this PR and the Gtk window just shows black, which doesn't happen on master

@IanButterworth
Copy link
Member Author

The last commit doesn't fix the Gtk issue, but it seems like a better approach

@giordano
Copy link
Contributor

giordano commented Jan 2, 2022

I presume the gtk issue isn't JuliaGraphics/Gtk.jl#590?

Edit: it isn't clear to me whether the bug was specific to the M1 or not, in any case it should have been fixed by JuliaPackaging/Yggdrasil#4150

@IanButterworth
Copy link
Member Author

Yeah! That fixes ProfileView. Thanks.

Unfortunately more testing of this PR has shown it's interfering with execution time substantially

julia> t = Timer(10)

julia> @profile while isopen(t)
       run(`pwd`)
       sleep(0.1)
       end
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia
/Users/ian/Documents/GitHub/julia

julia>

So run only gets to acquire the profiling lock 3 times in 10 seconds

@IanButterworth
Copy link
Member Author

Switching the lock nesting fixes that ^

@vtjnash
Copy link
Member

vtjnash commented Jan 7, 2022

superseded by #43701

@vtjnash vtjnash closed this Jan 7, 2022
@IanButterworth IanButterworth deleted the ib/profile_lock_fix branch January 7, 2022 17:40
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
3 participants