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: not properly registering interests for IO coming from ffi(?) #94

Closed
HoneyryderChuck opened this issue May 24, 2016 · 3 comments
Closed

Comments

@HoneyryderChuck
Copy link
Contributor

I'm writing a ruby client for net-snmp using ffi and making it compatible with celluloid-io. For MRI, it has been working alright. I'm having issues with jruby 9k, though.

All the examples have been done using 9.1.1.0 (latest release). The following example works:

# example script of creating io object from fd and passing it to the selector
io = IO.for_fd 2 # stderrr
IO.select [], [io] #=> [], [io]
selector = NIO::Selector.new
selector.register(io, :w)

Problem is when I'm acting on a file descriptor coming from the snmp session structure. As it's all done in C, I'm "deep-fetching" from the structure and initializing an IO object, which would then be passed to the reactor.

...
require 'nio'
io = IO.for_fd(fd_from_the_snmp_structure)
# this works, btw
IO.select [], [io] #=> [], [io]

selector = NIO::Selector.new
selector.register(io, :w) #=>
ArgumentError: mode not supported for this object: r
  register at org/nio4r/Nio4r.java:172

as previously stated, it works under MRI. It might be a bug in jruby, it's a bit hard for me to figure out, problem seems however to be in the symbolToInterestOps in the java extension(?), possibly, maybe. Is the first such report, or do I have to dig a bit deeper?

@tarcieri
Copy link
Contributor

@TiagoCardoso1983 that indicates the underlying NIO channel does not support being monitored for reading. I'd suggest opening a JRuby issue and we can discuss there.

@HoneyryderChuck
Copy link
Contributor Author

I had the feeling it was on jruby. Done.

@tarcieri
Copy link
Contributor

tarcieri commented Sep 4, 2016

We can continue the discussion on the JRuby thread. I am guessing that if it's resolved though, you might run into issues with #67.

@tarcieri tarcieri closed this as completed Sep 4, 2016
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

No branches or pull requests

2 participants