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

IO::EWOULDBLOCKWaitReadable Exception class not defined #4473

Closed
Abdulrazak-Alkl opened this Issue Feb 3, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@Abdulrazak-Alkl

Abdulrazak-Alkl commented Feb 3, 2017

Environment

  • JRuby version
    jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 24.80-b11 on 1.7.0_80-b15 +jit [linux-x86_64]

  • Operating system
    Linux abd-laptop 3.16.0-031600-generic #201408031935 SMP Sun Aug 3 23:36:11 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I have trouble in using bunny gem (https://github.com/ruby-amqp/bunny) with above environment

The Error:

NameError: uninitialized constant IO::EWOULDBLOCKWaitReadable
org/jruby/RubyModule.java:3344:in `const_missing'

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 8, 2017

Member

It looks like we bind EAGAINWaitReadable but not EWOULDBLOCKWaitReadable. Not sure where the latter is being used. Will investigate.

Member

headius commented Feb 8, 2017

It looks like we bind EAGAINWaitReadable but not EWOULDBLOCKWaitReadable. Not sure where the latter is being used. Will investigate.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 8, 2017

Member

We need to get the complete backtrace for this. I could find no reference to EWOULDBLOCKWaitReadable in JRuby, so I suspect this is coming from some external library.

If you can provide a reproduction, that would be best. Otherwise,

  1. Trigger the error and capture the full backtrace.
  2. Trigger the error while passing -Xbacktrace.style=full to JRuby.
  3. Put both traces in a gist and add a comment here.

I have the following trivial patch that ensures this class is defined, but I'd like to know who's trying to access it.

diff --git a/core/src/main/ruby/jruby/kernel/io.rb b/core/src/main/ruby/jruby/kernel/io.rb
index 69fb8b5..753d6d8 100644
--- a/core/src/main/ruby/jruby/kernel/io.rb
+++ b/core/src/main/ruby/jruby/kernel/io.rb
@@ -7,6 +7,19 @@ class IO
     include IO::WaitWritable
   end
 
+  if Errno::EAGAIN == Errno::WOULDBLOCK
+    IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
+    IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
+  else
+    class EWOULDBLOCKWaitReadable < Errno::EWOULDBLOCK
+      include IO::WaitReadable
+    end
+
+    class EWOULDBLOCKWaitWritable < Errno::EWOULDBLOCK
+      include IO::WaitWritable
+    end
+  end
+
   class EINPROGRESSWaitWritable < Errno::EINPROGRESS
     include IO::WaitWritable
   end
Member

headius commented Feb 8, 2017

We need to get the complete backtrace for this. I could find no reference to EWOULDBLOCKWaitReadable in JRuby, so I suspect this is coming from some external library.

If you can provide a reproduction, that would be best. Otherwise,

  1. Trigger the error and capture the full backtrace.
  2. Trigger the error while passing -Xbacktrace.style=full to JRuby.
  3. Put both traces in a gist and add a comment here.

I have the following trivial patch that ensures this class is defined, but I'd like to know who's trying to access it.

diff --git a/core/src/main/ruby/jruby/kernel/io.rb b/core/src/main/ruby/jruby/kernel/io.rb
index 69fb8b5..753d6d8 100644
--- a/core/src/main/ruby/jruby/kernel/io.rb
+++ b/core/src/main/ruby/jruby/kernel/io.rb
@@ -7,6 +7,19 @@ class IO
     include IO::WaitWritable
   end
 
+  if Errno::EAGAIN == Errno::WOULDBLOCK
+    IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
+    IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
+  else
+    class EWOULDBLOCKWaitReadable < Errno::EWOULDBLOCK
+      include IO::WaitReadable
+    end
+
+    class EWOULDBLOCKWaitWritable < Errno::EWOULDBLOCK
+      include IO::WaitWritable
+    end
+  end
+
   class EINPROGRESSWaitWritable < Errno::EINPROGRESS
     include IO::WaitWritable
   end

@headius headius added this to the JRuby 9.1.8.0 milestone Feb 8, 2017

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 9, 2017

Member

I have pushed #4486 that should fix this, but without knowing what caused it I can't be sure. This will have to wait on feedback from @Abdulrazak-Alkl.

Member

headius commented Feb 9, 2017

I have pushed #4486 that should fix this, but without knowing what caused it I can't be sure. This will have to wait on feedback from @Abdulrazak-Alkl.

@Abdulrazak-Alkl

This comment has been minimized.

Show comment
Hide comment
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Feb 13, 2017

Member

Ok, it looks like this is an oversight in JRuby. We defined the EAGAIN version but not the EWOULDBLOCK version, and this is the first case where someone actually wanted that class to be defined. I'll merge the patch...should be good.

Member

headius commented Feb 13, 2017

Ok, it looks like this is an oversight in JRuby. We defined the EAGAIN version but not the EWOULDBLOCK version, and this is the first case where someone actually wanted that class to be defined. I'll merge the patch...should be good.

headius added a commit to headius/jruby that referenced this issue Feb 13, 2017

@headius headius closed this in cb69360 Feb 13, 2017

headius added a commit that referenced this issue Feb 13, 2017

Merge pull request #4486 from headius/fix-ewouldblock-waitreadable
Set up EWOULDBLOCKWaitReadable/Writable if not present. Fix #4473
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment