mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(backend): handle systems with glibc
< 2.33
`mallinfo2` is not available on `glibc` < 2.33. On these systems, we successfully load the library but get an `AttributeError` on attempting to access `mallinfo2`. I'm not sure if the old `mallinfo` will work, and not sure how to install it safely to test, so for now we just handle the `AttributeError`. This means the enhanced memory snapshot logic will be skipped for these systems, which isn't a big deal.
This commit is contained in:
parent
75663ec81e
commit
f19c6069a9
@ -55,8 +55,10 @@ class MemorySnapshot:
|
||||
|
||||
try:
|
||||
malloc_info = LibcUtil().mallinfo2()
|
||||
except OSError:
|
||||
# This is expected in environments that do not have the 'libc.so.6' shared library.
|
||||
except (OSError, AttributeError):
|
||||
# OSError: This is expected in environments that do not have the 'libc.so.6' shared library.
|
||||
# AttributeError: This is expected in environments that have `libc.so.6` but do not have the `mallinfo2` (e.g. glibc < 2.33)
|
||||
# TODO: Does `mallinfo` work?
|
||||
malloc_info = None
|
||||
|
||||
return cls(process_ram, vram, malloc_info)
|
||||
|
@ -11,7 +11,10 @@ def test_libc_util_mallinfo2():
|
||||
# TODO: Set the expected result preemptively based on the system properties.
|
||||
pytest.xfail("libc shared library is not available on this system.")
|
||||
|
||||
info = libc.mallinfo2()
|
||||
try:
|
||||
info = libc.mallinfo2()
|
||||
except AttributeError:
|
||||
pytest.xfail("`mallinfo2` is not available on this system, likely due to glibc < 2.33.")
|
||||
|
||||
assert info.arena > 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user