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

HDDS-11811. rocksdbjni deleted on exit could be used by other components #7493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adoroszlai
Copy link
Contributor

@adoroszlai adoroszlai commented Nov 26, 2024

What changes were proposed in this pull request?

NativeLibraryLoader copies the library being loaded to the directory defined by native.lib.tmp.dir property (e.g. /tmp). It uses a temporary file name as target to avoid conflicts. It also copies some dependencies, whose names are preserved to ensure library links are not broken. All libs are deleted when the process exits.

Multiple Ozone processes running on the same host all copy libs to the same path (/tmp/librocksdbjni-linux64.so). Copying and deleting both introduce race conditions, causing other processes to see incomplete or no file at all.

This PR fixes the problem by creating a temporary dir with unique name, and copying all libs with original name to that dir.

https://issues.apache.org/jira/browse/HDDS-11811

How was this patch tested?

Updated unit test case.

[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.633 s - in org.apache.hadoop.hdds.utils.TestNativeLibraryLoader

Built locally with native libs.

$ mvn -DskipTests -DskipRecon -Drocks_tools_native clean package
$ cd hadoop-ozone/dist/target/ozone-2.0.0-SNAPSHOT

$ bin/ozone checknative
Native library checking:
hadoop:  false 
ISA-L:   false 
rocks-tools: true libozone_rocksdb_tools.so

$ export OZONE_OPTS=-Dnative.lib.tmp.dir=/no-such-dir

$ bin/ozone checknative
Native library checking:
hadoop:  false 
ISA-L:   false 
rocks-tools: false 

CI:
https://github.com/adoroszlai/ozone/actions/runs/12039265661

@adoroszlai adoroszlai self-assigned this Nov 26, 2024
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

Successfully merging this pull request may close these issues.

1 participant