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

JRuby 1.7.11 (bundled with LogStash v. 1.4.1) fails on FreeBSD 10.0 with NotImplementedError: stat.st_dev unsupported or native support failed to load #1754

Closed
emcrisostomo opened this Issue Jun 18, 2014 · 12 comments

Comments

Projects
None yet
6 participants
@emcrisostomo
Copy link

emcrisostomo commented Jun 18, 2014

JRuby 1.7.11 fails on FreeBSD 10.0 with NotImplementedError: stat.st_dev unsupported or native support failed to load. This version is bundled with LogStash v. 1.4.1 and I haven't tried others. However, since this is a long standing issue (as explained below), I guess other JRuby versions might be affected.

The complete error dumped to the console is the following:

NotImplementedError: stat.st_dev unsupported or native support failed to load
       dev_major at org/jruby/RubyFileStat.java:190
  _discover_file at /opt/logstash-1.4.1/vendor/bundle/jruby/1.9/gems/filewatch-0.5.1/lib/filewatch/watch.rb:140
            each at org/jruby/RubyArray.java:1613
  _discover_file at /opt/logstash-1.4.1/vendor/bundle/jruby/1.9/gems/filewatch-0.5.1/lib/filewatch/watch.rb:122
           watch at /opt/logstash-1.4.1/vendor/bundle/jruby/1.9/gems/filewatch-0.5.1/lib/filewatch/watch.rb:34
            tail at /opt/logstash-1.4.1/vendor/bundle/jruby/1.9/gems/filewatch-0.5.1/lib/filewatch/tail.rb:58
             run at /opt/logstash-1.4.1/lib/logstash/inputs/file.rb:130
            each at org/jruby/RubyArray.java:1613
             run at /opt/logstash-1.4.1/lib/logstash/inputs/file.rb:130
     inputworker at /opt/logstash-1.4.1/lib/logstash/pipeline.rb:163
     start_input at /opt/logstash-1.4.1/lib/logstash/pipeline.rb:157

This error can be reproduced in FreeBSD 10.0. I initially opened one issue on LogStash's issue tracker (very similar to another one affecting Solaris) but it seems a JRuby issue instead.

Thank you very much for looking into this.

Cheers,
-- Enrico

@nirvdrum

This comment has been minimized.

Copy link
Contributor

nirvdrum commented Jun 23, 2014

I swear this came up in IRC not too long ago, but I don't recall what the outcome was. I think it had something to do with the library load path being messed up somehow. This should be implemented in FreeBSD:

https://github.com/jnr/jnr-posix/blob/1be3a8871c076e0707ada78392814ef6ebe1d768/src/main/java/jnr/posix/FreeBSDFileStat.java#L92-L94

But it looks like that's not being used.

Have you disabled native library support by chance?

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Jun 23, 2014

Hi @nirvdrum, thank you very much for your answer.

No, the environment under which the application is started should be clean, so native library support should get its default value. I tried setting the jruby.native.enabled property but the error is the same no matter if it is true or false.

However, it seems clear from your source pointer that it should be implemented in FreeBSD so that I tried replicating the same setup in the previous FreeBSD release (9.2) and there, it works.

I tried searching JRuby's IRC channel logs here but the Search link there seems to be broken. However, I'll investigate about the library load path.

Cheers,
-- Enrico

@nirvdrum

This comment has been minimized.

Copy link
Contributor

nirvdrum commented Jun 23, 2014

It may be related to these jnr-ffi issues:

jnr/jnr-ffi#16
jnr/jnr-ffi#17
jnr/jnr-ffi#18

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Jun 23, 2014

Thank you very much, @nirvdrum, they look like they could be the cause of the problem.

Cheers,
-- Enrico

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Oct 2, 2014

Hi all,

I've sent PR 26 to jnr-ffi to fix this issue, that is the same patch suggested in PR 18 and PR 21 (for which the Travis CI build was failing, and I guess that was the reason for them to be ignored).

I'm leaving this comment for reference because It seems that no PR in the jnr-ffi repository has been replied to in quite some time, and I guess affected users may end up here as well.

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Oct 27, 2014

Hi all,

Here's a follow-up on this issue.

jnr-ffi upstream has been silent so far, so that I had to fork that project in order to be provide a temporary fix to FreeBSD's logstash port. Until jnr-ffi is broken on FreeBSD I'll try to maintain my fork alive and to track upstream. If anybody hits this bug on other platforms (besides FreeBSD I've seen reports of Solaris being affected), you can build jnr-ffi from my fork and use it as a drop-in replacement.

The best solution, however, would be upstream fixing the problem. It is ironic to choose to use Java programs and libraries only to discover that they fail on your platform because they have incompatible native bindings.

Since JRuby is using jnr-ffi and the bug sometimes deceives user into believing it's a JRuby bug, would it be possible for you to kindly lobby jnr-ffi to at least take the PR into consideration? After all, this may be JRuby's collateral damage.

Thanks,

Enrico.

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Jan 28, 2015

Hi all,

the PR fixing this issue has been merged into jnr-ffi upstream.

@mkristian mkristian added this to the JRuby 1.7.19 milestone Jan 28, 2015

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Jan 28, 2015

thanx for the follow up

let's keep it open until we get jnr-ffi released and used by jruby

@enebo enebo modified the milestones: JRuby 1.7.19, JRuby 1.7.20 Jan 28, 2015

@kryten68

This comment has been minimized.

Copy link

kryten68 commented Mar 3, 2015

Hi,

I'm seeing pretty much exactly this error on SunOS 5.8 on sparc using Logstash 1.4.3.
With:
java version "1.6.0_41"
Java(TM) SE Runtime Environment (build 1.6.0_41-b02)
Java HotSpot(TM) Server VM (build 20.14-b01, mixed mode)

The full error is below. Could anyone shed any light on this error and how to resolve it? I arrived here as the error appears to be a very close match.

Thanks
Stuart

// ERROR MESSAGE//
NotImplementedError: stat.st_dev unsupported or native support failed to load
dev_major at org/jruby/RubyFileStat.java:190
_discover_file at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/filewatch/watch.rb:150
each at org/jruby/RubyArray.java:1613
_discover_file at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/filewatch/watch.rb:132
watch at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/filewatch/watch.rb:38
tail at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/filewatch/tail.rb:67
run at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/logstash/inputs/file.rb:130
each at org/jruby/RubyArray.java:1613
run at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/logstash/inputs/file.rb:130
inputworker at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/logstash/pipeline.rb:163
start_input at /home/sitescope/logstash/logstash-1.4.3.dev-modified/lib/logstash/pipeline.rb:157
+---------------------------------------------------------+
| An unexpected error occurred. This is probably a bug. |
| You can find help with this problem in a few places: |
| |
| * chat: #logstash IRC channel on freenode irc. |
| IRC via the web: http://goo.gl/TI4Ro |
| * email: logstash-users@googlegroups.com |
| * bug system: https://logstash.jira.com/ |
| |
+---------------------------------------------------------+
The error reported is:
Bad file number - Bad file descriptor

@emcrisostomo

This comment has been minimized.

Copy link
Author

emcrisostomo commented Mar 5, 2015

Hi @kryten68, if you are curious, have a look at jnr/jnr-ffi#26: at least on FreeBSD jnr-ffi is choking on an ld script (beginning with a comment) and it incorrectly reports it as a broken binary.

Patching jnr-ffi is easy (it's just a regular expression to fix) but then you have to substitute the recompiled Java class into the JRuby JAR bundled with Logstash.

Chances are the same thing is happening on Solaris: check the library that it's trying to open and see if it's an ld script.

The FreeBSD port Makefile has the code to patch the Logstash distribution: you can use that code and, until JRuby bundles the patched jnr-ffi and until this new JRuby version ends into Logstash, you can use my jnr-ffi fork.

@mkristian mkristian self-assigned this Apr 8, 2015

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Apr 9, 2015

closing since jnr/jnr-ffi#26 is part of jnr-ffi-2.0.2

@kryten68 could file an issue for solaris - can not help due to lack of access to Solaris - maybe you can prepare a PR which is definitely welcome ;)

@mkristian mkristian closed this Apr 9, 2015

@uhammec

This comment has been minimized.

Copy link

uhammec commented Apr 10, 2015

Having the precisely same problem on Solaris 5.9 with logstash-1.4.2.

Logstash is doing stat = File::Stat.new(file) and needs the inode number returned. Is there any different call that can be used to get the inode number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.