-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 seg fault when executing simple python script importing Tf with -m unittest #2102
Comments
Hi, it might help to know which dynamic library was being loaded when the crash occurred. In frame 16, is it possible to determine the path being supplied? |
Hey @meshula - thanks for the tip! I did not have much luck printing the path supplied to (lldb) process launch --environment DYLD_PRINT_APIS=1 -- -m unittest test.py
There is a running process, kill it and restart?: [Y/n] y
Process 61474 exited with status = 9 (0x00000009)
Process 61493 launched: '/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python' (arm64)
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_sdk_at_least(0x100000000, <1,0x000A0900>) => 1
dyld[61493]: _dyld_get_image_slide(0x100000000) => 0x0
dyld[61493]: dyld_process_is_restricted() => 0
dyld[61493]: _dyld_get_image_slide(0x100000000) => 0x0
dyld[61493]: NSVersionOfLinkTimeLibrary(System) =>0x051F6403
dyld[61493]: _dyld_is_memory_immutable(0x189524f99, 18) => 1
dyld[61493]: _dyld_is_memory_immutable(0x189524f99, 18) => 1
dyld[61493]: _dyld_is_memory_immutable(0x189525611, 17) => 1
dyld[61493]: _dyld_register_func_for_add_image(0x194249a44)
dyld[61493]: _dyld_register_func_for_remove_image(0x194249cfc)
dyld[61493]: _dyld_objc_notify_register(0x189570ee8, 0x18957905c, 0x18959520c)
dyld[61493]: _dyld_get_shared_cache_range(0x16fdfdc40) => 0x1893c4000,0xBB70C000
dyld[61493]: _dyld_get_prog_image_header() => 0x100000000
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_shared_cache_some_image_overridden() => 0
dyld[61493]: _dyld_register_for_bulk_image_loads(0x189419438)
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: _NSGetExecutablePath(0x16fdfdcc8, 0x16fdfdcc4)
dyld[61493]: _dyld_get_shared_cache_range(0x1e2655a78) => 0x1893c4000,0xBB70C000
dyld[61493]: _dyld_is_memory_immutable(0x189472609, 36) => 1
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_get_program_sdk_version() => 0x000C0300
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: _dyld_is_memory_immutable(0x189b3b213, 11) => 1
dyld[61493]: _dyld_is_memory_immutable(0x189b3b213, 11) => 1
dyld[61493]: dyld_get_active_platform() => 1
dyld[61493]: dyld_process_is_restricted() => 0
dyld[61493]: _NSGetExecutablePath(0x16fdfd330, 0x16fdfd740)
dyld[61493]: dyld_has_inserted_or_interposing_libraries() => 0
dyld[61493]: _NSGetExecutablePath(0x16fdfd3a7, 0x16fdfd3a0)
dyld[61493]: NSLibraryNameForModule(0x20018cea0)
dyld[61493]: _dyld_is_memory_immutable(0x18962cec8, 26) => 1
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_heapq.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(_heapq.cpython-310-darwin.so) => 0x20018d860
dyld[61493]: dlsym(0x20018d860, "PyInit__heapq")
dyld[61493]: dlsym("PyInit__heapq") => 0x100229520
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_opcode.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(_opcode.cpython-310-darwin.so) => 0x20018dc60
dyld[61493]: dlsym(0x20018dc60, "PyInit__opcode")
dyld[61493]: dlsym("PyInit__opcode") => 0x10023bb88
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/zlib.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(zlib.cpython-310-darwin.so) => 0x20018de60
dyld[61493]: dlsym(0x20018de60, "PyInit_zlib")
dyld[61493]: dlsym("PyInit_zlib") => 0x10025f28c
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_bz2.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(_bz2.cpython-310-darwin.so) => 0x20018e060
dyld[61493]: dlsym(0x20018e060, "PyInit__bz2")
dyld[61493]: dlsym("PyInit__bz2") => 0x10024a284
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_lzma.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(_lzma.cpython-310-darwin.so) => 0x20018e260
dyld[61493]: dlsym(0x20018e260, "PyInit__lzma")
dyld[61493]: dlsym("PyInit__lzma") => 0x10028be58
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/fcntl.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(fcntl.cpython-310-darwin.so) => 0x20018e5a0
dyld[61493]: dlsym(0x20018e5a0, "PyInit_fcntl")
dyld[61493]: dlsym("PyInit_fcntl") => 0x100272190
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_posixsubprocess.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(_posixsubprocess.cpython-310-darwin.so) => 0x20018e7a0
dyld[61493]: dlsym(0x20018e7a0, "PyInit__posixsubprocess")
dyld[61493]: dlsym("PyInit__posixsubprocess") => 0x1002a261c
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/select.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(select.cpython-310-darwin.so) => 0x20018e9a0
dyld[61493]: dlsym(0x20018e9a0, "PyInit_select")
dyld[61493]: dlsym("PyInit_select") => 0x100505d70
dyld[61493]: dlopen("/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/math.cpython-310-darwin.so", 0x00000002)
dyld[61493]: dlopen(math.cpython-310-darwin.so) => 0x20018eba0
dyld[61493]: dlsym(0x20018eba0, "PyInit_math")
dyld[61493]: dlsym("PyInit_math") => 0x1005183e0
dyld[61493]: dlopen("/Users/richard.lei/apps/USD_dbg/lib/python/pxr/Tf/_tf.so", 0x00000002)
dyld[61493]: _dyld_register_func_for_add_image(0x10296de8c)
dyld[61493]: dladdr(0x10280c0a8, 0x16fdf6800)
dyld[61493]: dlopen("(null)", 0x00000001)
dyld[61493]: dlsym(0xfffffffffffffffe, "scalable_malloc")
dyld[61493]: dlsym("scalable_malloc") => NULL
dyld[61493]: dlclose(0xfffffffffffffffe)
dyld[61493]: dlopen("/Users/richard.lei/apps/USD_dbg/lib/libtbbmalloc_debug.dylib", 0x00000001)
dyld[61493]: dlopen("libtbbmalloc_debug.dylib", 0x00000002)
dyld[61493]: dlopen(libtbbmalloc_debug.dylib) => 0x20018ff00
dyld[61493]: dlopen(libtbbmalloc_debug.dylib) => 0x20018ff00
dyld[61493]: dlsym(0x20018ff00, "scalable_malloc")
dyld[61493]: dlsym("scalable_malloc") => 0x100fa3548
dyld[61493]: dlsym(0x20018ff00, "scalable_free")
dyld[61493]: dlsym("scalable_free") => 0x100fa3590
dyld[61493]: dlsym(0x20018ff00, "scalable_aligned_malloc")
dyld[61493]: dlsym("scalable_aligned_malloc") => 0x100fa3c18
dyld[61493]: dlsym(0x20018ff00, "scalable_aligned_free")
dyld[61493]: dlsym("scalable_aligned_free") => 0x100fa3eac
Process 61493 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000100022afc dyld`dyld4::Loader::loadAddress(dyld4::RuntimeState&) const + 12
dyld`dyld4::Loader::loadAddress:
-> 0x100022afc <+12>: ldr w8, [x0]
0x100022b00 <+16>: mov w9, #0x7964
0x100022b04 <+20>: movk w9, #0x6c34, lsl #16
0x100022b08 <+24>: cmp w8, w9
Target 0: (Python) stopped.
(lldb) (Note: I've built a debug variant of USD which is why the library names are different from the original description, still getting the same seg fault though) I noticed that preloading libtbbmalloc makes the crash go away: richard.lei /Users/richard.lei/dev/repro $ DYLD_INSERT_LIBRARIES=/Users/richard.lei/apps/USD_dbg/lib/libtbbmalloc_debug.dylib python3 -m unittest test.py
Success
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
richard.lei /Users/richard.lei/dev/repro $ Also, if Apart from the case where it was explicitly preloaded - I'm confused why -- Found TBB: /Users/richard.lei/apps/USD_dbg/include (found version "2019.0") found components: tbb
-- Using default system allocator because PXR_MALLOC_LIBRARY is unspecified Within the USD installation, the only |
Thanks for that information! We're looking at a related issue now. In the short term, can you rely on one of your workarounds? @sunyab is there anything else you might advise for the short term? |
@meshula great to know something similar is already being investigated. In the meanwhile relying on one of the workarounds is no problem at all, thanks! |
Hi @rlei-weta, like @meshula said we ran into the exact same crashes recently. We have a fix for this currently in the dev branch at 721c936, which will go out with the next USD release. (FYI, |
Filed as internal issue #USD-7786 |
@sunyab thanks for the fix - a build off the tip of |
Glad to help! Closing this one out. |
Description of Issue
Hello - I'm getting a seg fault in a MacOS build of USD 22.11 when executing a simple python script importing
pxr.Tf
with-m unittest
.Would appreciate any pointers :-) Thanks in advance
Steps to Reproduce
Notice that executing
test.py
without-m unittest
does not seg fault.System Information (OS, Hardware)
Package Versions
USD 22.11
Build Flags
Installed via:
python3 build_scripts/build_usd.py ~/apps/USD
Flags:
Full build log: log.txt
Additional debugging information
DYLD_PRINT_LIBRARIES
Seg fault case (with
-m unittest
):Working case (without
-m unittest
):lldb backtrace
The text was updated successfully, but these errors were encountered: