Skip to content

Commit

Permalink
gh-450: Workaround for failing ASAN on macOS (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
itamaro authored Jan 23, 2024
1 parent 8906549 commit 7ee34b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions master/custom/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
UnixRefleakBuild,
UnixNoGilBuild,
UnixNoGilRefleakBuild,
UnixAsanNoGilBuild,
MacOSAsanNoGilBuild,
AIXBuild,
AIXBuildWithXLC,
PGOUnixBuild,
Expand Down Expand Up @@ -223,7 +223,7 @@
("AMD64 Windows Server 2022 NoGIL", "itamaro-win64-srv-22-aws", Windows64NoGilBuild),

# macOS x86-64 clang
("x86-64 MacOS Intel ASAN NoGIL", "itamaro-macos-intel-aws", UnixAsanNoGilBuild),
("x86-64 MacOS Intel ASAN NoGIL", "itamaro-macos-intel-aws", MacOSAsanNoGilBuild),
]


Expand Down
25 changes: 25 additions & 0 deletions master/custom/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,31 @@ class MacOSArmWithBrewNoGilRefleakBuild(UnixNoGilRefleakBuild):
"LDFLAGS=-L/opt/homebrew/lib",
]


class MacOSAsanNoGilBuild(UnixAsanNoGilBuild):
buildersuffix = ".macos-with-brew.asan.nogil"
configureFlags = UnixAsanNoGilBuild.configureFlags + [
"--with-openssl=/opt/homebrew/opt/openssl@3",
"CPPFLAGS=-I/opt/homebrew/include",
"LDFLAGS=-L/opt/homebrew/lib",
]
asan_options = 'detect_leaks=0:allocator_may_return_null=1:handle_segv=0'
compile_environ = {'ASAN_OPTIONS': asan_options}
test_environ = {
'ASAN_OPTIONS': asan_options,
# Note: Need to set `MallocNanoZone=0` environment variable to workaround a macOS issue.
# This was needed to workaround an issue with this builder that manifested as failures in 3 tests:
# test_cmd_line, test_posix, test_subprocess
# These failures seem to be related to the occurrence of this warning:
# python.exe(74602,0x7ff84626a700) malloc: nano zone abandoned due to inability to reserve vm space.
# It is unclear why (or if) it's *directly* causing the test failures, but setting `MallocNanoZone=0`
# disables this optimization (and fixes the tests), which appears to be interfering with ASAN. See also:
# https://stackoverflow.com/questions/64126942/malloc-nano-zone-abandoned-due-to-inability-to-preallocate-reserved-vm-space
# https://github.com/python/buildmaster-config/issues/450 (and attached PR)
'MallocNanoZone': '0',
}


##############################################################################
############################ WINDOWS BUILDS ################################
##############################################################################
Expand Down

0 comments on commit 7ee34b6

Please sign in to comment.