apple / apple/foundationdb

Investigate dlmopen+LM_ID_NEWLM vs copying libfdb_c.so multiple times

Open
#6,300 1 comment 0 reactions 1 assignee Claimed by @sfc-gh-vgasiunas View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.