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

Avoid segfault when ptls->safepoint is NULL (rebased #27020) #32254

Closed

Conversation

benlorenz
Copy link
Contributor

This is the same as #27020 but rebased onto the current master. There were positive reviews but some CI issues at the time, lets hope it is better this time.

We have hit this issue with an external library that creates openmp threads which trigger the gc via gmp allocations.

@StefanKarpinski
Copy link
Member

Mmm. That all-green CI!

There are cases (eg: when __gmpz_init is called from python via PyCall in a
secondary thread) where ptls->safepoint is NULL when maybe_collect is called,
and *ptls->safepoint causes a NULL pointer dereference and a segfault.  This
change fixes that case.

Included test in test/threads.jl that will reproduce this issue.

See JuliaLang#27020 for backtrace and more details
@benlorenz benlorenz force-pushed the fix/gc-segfault-rebased branch from 6c5242b to 4af4411 Compare July 23, 2019 15:31
@benlorenz
Copy link
Contributor Author

I rebased the branch onto the current master again and put the now thread-local gc counters into the if statement as well.

@thofma
Copy link
Contributor

thofma commented Sep 17, 2019

I guess this is superseded by #33284?

@vtjnash vtjnash closed this Sep 17, 2019
@benlorenz benlorenz deleted the fix/gc-segfault-rebased branch September 17, 2019 21:52
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.

5 participants