Investigate dlmopen+LM_ID_NEWLM vs copying libfdb_c.so multiple times
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
To enable having multiple network threads, the current client implementation opens the shared library multiple times. For these to be given separate instances of static data, one copy of libfdb_c.so is created per thread, so that it appears to be and is loaded as a "different" instance of the library for each thread.
There's an alternative approach to this, which is to utilize the linker's notion of namespaces, to instead dlmopen() a new instance of the library into a new namespace for each thread. This removes the need to copy libfdb_c.so, and to have a secure temporary location for the client library files. This will add a limit of a maximum of 15 network threads (as there's a 16 namespace limit in glibc), and potentially the loading will be tricker as any dynamic dependencies will need to be satisfied manually. But avoiding the copy seems nice for both startup time and security, so possibly still worth investigating.
Contributor guide
Assessment
This issue has not been assessed yet.