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

libmercury_util.so.4 causes a segfault on exit when leveraged through Python/CFFI #729

Closed
bgeltz opened this issue Mar 15, 2024 · 6 comments

Comments

@bgeltz
Copy link

bgeltz commented Mar 15, 2024

Describe the bug
When using Python and CFFI to dlopen any library that has a dependency on libmercury.so.2, a segfault occurs when Python exits, pointing to libmercury_util.so.4.

To Reproduce

  1. Ensure cffi is available: zypper install python3-cffi
  2. Install Mercury: zypper install mercury mercury-devel
  3. Create repro.py with the following contents:
import cffi

gffi = cffi.FFI()
dl_mercury = gffi.dlopen('libmercury.so.2')
  1. Run repro.py with the system Python interpreter and observe the segfault:
$ python3 repro.py
Segmentation fault (core dumped)

Expected behavior
No segfault occurs when Python is unloaded.

Platform:

  • OS = SLES 15.4
  • mercury and mercury-devel version reported by zypper = 2.3.1-2.suse.lp155
  • System Python = 3.6.15
  • System Python CFFI version = 1.13.2

Additional context
The stack trace of python3 at the time of the segfault as reported by coredumpctl is:

#0  0x000014ffd1989a50 n/a (libmercury_util.so.4 + 0x3a50)
#1  0x000014ffd242e843 _dl_fini (ld-linux-x86-64.so.2 + 0x11843)
#2  0x000014ffd1f54a99 __run_exit_handlers (libc.so.6 + 0x4da99)
#3  0x000014ffd1f54c2a exit (libc.so.6 + 0x4dc2a)
#4  0x000014ffd1f3c254 __libc_start_main (libc.so.6 + 0x35254)
#5  0x000055d2ebe61d5a _start (python3.6 + 0xd5a)
@soumagne
Copy link
Member

thanks for reporting the issue, I was able to reproduce it, this seems specific to having mercury compiled with support for dynamic plugins (which is the default for mercury rpms). Looking into a fix now.

soumagne added a commit to soumagne/mercury that referenced this issue Mar 19, 2024
NA: fix missing free of dynamic plugin entries
@soumagne
Copy link
Member

fix was merged, I'll propagate the fix into the mercury-2.3.1-3 rpm as well.

@bgeltz
Copy link
Author

bgeltz commented Mar 20, 2024

Thanks! Much appreciated.

@bgeltz
Copy link
Author

bgeltz commented Apr 26, 2024

Was this fix ever propagated into mercury-2.3.1-3? If yes, where are those RPMs available?

@soumagne
Copy link
Member

it was internally but I'm not sure you'll be able to see it until a new release of DAOS is made because of the SDL process. Which repo are you using for your rpms ?

@bgeltz
Copy link
Author

bgeltz commented Apr 26, 2024

That's a great question. Let me chase this internally and see what I can figure out. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants