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

Improving error message when flock is not available #3699

frsyuki opened this issue Feb 25, 2016 · 1 comment

Improving error message when flock is not available #3699

frsyuki opened this issue Feb 25, 2016 · 1 comment


Copy link

frsyuki commented Feb 25, 2016


  • we got flock unsupported or native support failed to load error.
  • it was difficult to debug the cause until we find -Xnative.verbose=true option from JRuby source code.
  • it's helpful if error message shows a way to debug the cause.
  • actual the cause was that /tmp was mounted with noexec option.


Installing a gem failed with this error:

$ embulk gem install embulk-input-jdbc
2016-02-19 18:45:43.698 -0600: Embulk v0.8.5
Fetching: embulk-input-jdbc-0.6.4.gem (100%)
NotImplementedError: flock unsupported or native support failed to load
                       flock at org/jruby/
  block in cache_update_path at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/remote_fetcher.rb:316
                        open at org/jruby/
                        open at org/jruby/
           cache_update_path at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/remote_fetcher.rb:315
                    download at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/remote_fetcher.rb:174
                    download at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/source.rb:210
                    download at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/resolver/activation_request.rb:60
            block in install at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/request_set.rb:160
                        each at org/jruby/
                     install at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/request_set.rb:150
                 install_gem at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/commands/install_command.rb:249
       block in install_gems at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/commands/install_command.rb:299
                        each at org/jruby/
                install_gems at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/commands/install_command.rb:295
                     execute at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/commands/install_command.rb:202
      invoke_with_build_args at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/command.rb:307
                process_args at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/command_manager.rb:168
                         run at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/command_manager.rb:138
                         run at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/gem_runner.rb:54
                         run at /home/sneisius/.embulk/bin/embulk!/embulk/command/embulk_run.rb:165
                       <top> at /home/sneisius/.embulk/bin/embulk!/embulk/command/embulk_main.rb:2
                     require at org/jruby/
                      (root) at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
                       <top> at file:/home/sneisius/.embulk/bin/embulk!/embulk/command/embulk_bundle.rb:51```

After digging into the source code, we found that the error happens when jruby works with jnr-posix. Then, we found -Xnative.verbose=true option that shows stacktrace. Here is the full stacktrace:

This error possibly happens when /tmp is mounted with noexec, or execution on /tmp is prohibited by SELinux. But it was hard for us to come to this conclusion because error message doesn't suggest how to debug the cause of the failure when it loads a native library.

It would be good if the error message suggests how to debug the cause. For example:

diff --git a/core/src/main/java/org/jruby/ext/ b/core/src/main/java/org/jruby/ext/
index 5c249f4..2689b7d 100644
--- a/core/src/main/java/org/jruby/ext/
+++ b/core/src/main/java/org/jruby/ext/
@@ -48,7 +48,7 @@ public class JRubyPOSIXHandler implements POSIXHandler {

     public void unimplementedError(String method) {
-        throw runtime.newNotImplementedError(method + " unsupported or native support failed to load");
+        throw runtime.newNotImplementedError(method + " unsupported or native support failed to load. Set _JAVA_OPTIONS=-Djruby.native.verbose=true environment variable to debug");

     public void warn(WARNING_ID id, String message, Object... data) {

I used _JAVA_OPTIONS here so that the suggestion is valid even if jruby is used as a library.

Some issues might have been easier to solve with this message: #3266 #3285 #3409


  • JRuby
  • RedHat Enterprise Linux 7
@headius headius added this to the JRuby milestone Mar 9, 2016
Copy link

headius commented Apr 19, 2016

I've added a page for gathering info about native library problems in JRuby here: I will add this to relevant error messages.

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

No branches or pull requests

3 participants