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

Improve error handling re: FFI loading when system temp dir is mounted 'noexec' #2186

Open
cprice404 opened this issue Nov 12, 2014 · 3 comments

Comments

@cprice404
Copy link
Contributor

When trying to load the FFI subsystem (via .so files embedded in jar), it appears that JRuby copies the .so files out of the jar into a temp dir and then loads them from there.

We had a user who was getting a cryptic error message today:

Failed to load native POSIX impl; falling back on Java impl.

After some sleuthing we determined that the user's /tmp dir was mounted noexec. Changing the mount options fixed the problem, but it would be nice to have a better error message. Ideally the error would state that:

  1. the tmp dir is not executable, and
  2. what options / flags can be used to change to a different temp dir

Our user was able to use -Djava.io.tmpdir.

@cprice404
Copy link
Contributor Author

also printing the path to the actual file that failed to load would be useful, if that's possible.

@cprice404
Copy link
Contributor Author

This has come up for us a few more times since I opened it. We're currently giving users info about the -Djava.io.tmpdir workaround, but that makes me a little leery because I believe it means that any other temp files that the process writes during its lifetime will also be written to that directory, which is bad.

I think it might be worth adding a jruby-ffi-specific config setting that could be used to define the temp location that would be used only for these files that need to be executable, and that way we wouldn't have to override the global temp dir.

@tduehr
Copy link
Contributor

tduehr commented Dec 5, 2014

This is probably a requirement of Java. That error message us related to the POSIX features which use a Java based FFI package (related to JRubys) not the ruby FFI package. it would appear you have to turn off the native features or provide Java with a place to put temporary files.

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

No branches or pull requests

3 participants