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

Don't mutate the hashtable with forward edges during final iteration. #46375

Merged
merged 1 commit into from
Aug 17, 2022

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Aug 17, 2022

By looking up keys using ptrhash_bp, we possibly grow the hash table, invalidating the iteration we were doing in jl_collect_backedges. First perform a non-mutating check instead, and assert that the hashtable doesn't change during iteration.

It's possible there's other cases of the map being mutated, so this may not be sufficient, but hopefully the added assertion will help us detect this issue (which only occurred when a failed lookup caused the hash table to grow, which is unlikely).

Hopefully fixes #45444. I'm not sure how far to backport this; If my understanding of this bug is correct it's been lurking since forever, while we've only been seeing this on PkgEval for a couple of months...

By looking up keys, we possibly grow the hash table, invalidating the iteration
we were doing in jl_collect_backedges. First perform a non-mutating check instead,
and assert that the hashtable doesn't change during iteration.
@maleadt maleadt added compiler:precompilation Precompilation of modules bugfix This change fixes an existing bug labels Aug 17, 2022
@maleadt
Copy link
Member Author

maleadt commented Aug 17, 2022

@nanosoldier runtests(ALL, configuration = (buildflags=["JULIA_BUILD_MODE=debug"], rr=true))

@maleadt maleadt added the backport 1.8 Change should be backported to release-1.8 label Aug 17, 2022
@nanosoldier
Copy link
Collaborator

Your package evaluation job has completed - possible issues were detected. A full report can be found here.

@maleadt
Copy link
Member Author

maleadt commented Aug 17, 2022

Looks like this did it; No jl_collect_backedges-related segfaults in the log anymore.

@JeffBezanson JeffBezanson merged commit 0ada892 into master Aug 17, 2022
@JeffBezanson JeffBezanson deleted the tb/edges_map_mutation branch August 17, 2022 19:46
@Moelf Moelf mentioned this pull request Aug 17, 2022
35 tasks
KristofferC pushed a commit that referenced this pull request Aug 26, 2022
…#46375)

By looking up keys, we possibly grow the hash table, invalidating the iteration
we were doing in jl_collect_backedges. First perform a non-mutating check instead,
and assert that the hashtable doesn't change during iteration.

(cherry picked from commit 0ada892)
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug compiler:precompilation Precompilation of modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault in jl_collect_backedges
4 participants