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

speed up the testcontainers ldd check using either ctypes or debug/elf #879

Open
jiridanek opened this issue Jan 31, 2025 · 0 comments
Open
Labels
good first issue Good for newcomers

Comments

@jiridanek
Copy link
Member

Since there's 1000 to 2000 dynamic libs to check in each of our images, the check on a macOS when using ldd can take 70 or more seconds.

When mentioned on a daily meeting, ppl weren't very concerned, so I'm not going to optimize this now.

For the future, already tried out one approach, using the debug/elf package in Go's standard library to simply read the DT_NEEDED field out of the libraries and check that. It's quite a lot of code, but it seems to work, and work fast.
check_elf_file_2.go.txt

Alternatively, it should be possible to just go around loading the dlls from the python script directly, to see if it loads or not

        from ctypes import CDLL
        try:
            CDLL(lib_path)
            print(f"Successfully loaded: {lib}")
        except Exception as e:
            print(f"Error loading {lib}: {e}")

Originally posted by @jiridanek in #871 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant