[Bug 2054943] Re: jruby: mri-extra - flaky TestOpen3 pipe tests

Vladimir Petko 2054943 at bugs.launchpad.net
Wed Apr 24 00:08:23 UTC 2024


openjdk-21 has fixed pipe issue in 21.0.3~7ea-1. 
https://launchpad.net/ubuntu/+source/openjdk-21/21.0.3~7ea-1

** Changed in: java-common (Ubuntu)
       Status: New => Fix Released

** Changed in: openjdk-21 (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to java-common in Ubuntu.
https://bugs.launchpad.net/bugs/2054943

Title:
  jruby: mri-extra - flaky TestOpen3  pipe tests

Status in java-common package in Ubuntu:
  Fix Released
Status in jruby package in Ubuntu:
  New
Status in openjdk-21 package in Ubuntu:
  Fix Released
Status in jruby package in Debian:
  New

Bug description:
  The autopkgtests for jruby fail  `mri-extra` with the following
  errors:

    1) Failure:
  TestOpen3#test_pipeline_start [/tmp/autopkgtest.Dz4xQk/autopkgtest_tmp/test/mri/test_open3.rb:303]:
  Failed assertion, no message given.

    2) Failure:
  TestOpen3#test_pipeline_w [/tmp/autopkgtest.Dz4xQk/autopkgtest_tmp/test/mri/test_open3.rb:288]:
  <true> expected but was
  <false>.

    3) Failure:
  TestOpen3#test_capture3_flip [/tmp/autopkgtest.Dz4xQk/autopkgtest_tmp/test/mri/test_open3.rb:190]:

  The minimal reproducer of those:
  ----
  require 'open3'

  RUBY = 'jruby'
  Open3.pipeline_r([RUBY, '-e', 'print "1"'],
                       [RUBY, '-e', 'print STDIN.read + "2"']) {|o,ts|
        print(o.read)
      }
  ---

  executing the above sample results in the following output:
  # jruby test.rb
  12# jruby test.rb
  12# jruby test.rb
  12# jruby test.rb
  12# jruby test.rb
  2# jruby test.rb
  12# jruby test.rb
  2# jruby test.rb
  12# jruby test.rb
  2# jruby test.rb
  2# jruby test.rb
  2# jruby test.rb
  2# jruby test.rb
  12# jruby test.rb
  12# jruby test.rb
  2Errno::EPIPE: Broken pipe - <STDOUT>
     write at org/jruby/RubyIO.java:1569
     write at org/jruby/RubyIO.java:1458
     write at org/jruby/RubyIO.java:2829
     print at org/jruby/RubyIO.java:1831
     print at org/jruby/RubyKernel.java:649
    <main> at -e:1

  Note: the failure occurs both with Java 21
  The root cause is that pipes are created non-blocking with Java 21.

  The workaround for the stream issue is below:
  ----

  require 'fcntl'
  flags = write.fcntl(Fcntl::F_GETFL)
  # We must first set nonblock because the Java and JRuby objects wrapping the stream do not know it is already non-blocking
  write.fcntl(Fcntl::F_SETFL, flags | (Fcntl::O_NONBLOCK)) 
  write.fcntl(Fcntl::F_SETFL, flags & (~Fcntl::O_NONBLOCK))
  ----

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/java-common/+bug/2054943/+subscriptions




More information about the foundations-bugs mailing list