From: Martin Bosslet Date: 2011-06-28T04:40:30+09:00 Subject: [ruby-core:37579] [Ruby 1.9 - Bug #4923] [ext/openssl] test_ssl.rb: test_client_auth fails Issue #4923 has been updated by Martin Bosslet. Martin Bosslet wrote: > 1) Error: > test_write_nonblock(OpenSSL::TestPair): > OpenSSL::SSL::SSLError: SSL_read:: bad write retry > /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:53:in `sysread' > /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:53:in `fill_rbuff' > /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:94:in `read' > /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:176:in `block in test_write_nonblock' > /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:44:in `ssl_pair' > /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:164:in `test_write_nonblock' > > 20 tests, 101 assertions, 0 failures, 1 errors, 0 skips I tested further and the test fails deterministically at the same spot each time. If I rewrite test_write_nonblock as follows: def test_write_nonblock ssl_pair {|s1, s2| n = 0 begin n += s1.write_nonblock("a" * 100000) n += s1.write_nonblock("b" * 100000) n += s1.write_nonblock("c" * 100000) 100000.times do |i| n += 1 begin s1.write_nonblock("d") rescue OpenSSL::SSL::SSLError => e p e puts "Iteration: #{i}" raise e end end puts "Da5" n += s1.write_nonblock("e" * 100000) puts "Da6" n += s1.write_nonblock("f" * 100000) puts "Da7" rescue IO::WaitWritable end s1.close assert_equal(n, s2.read.length) } end it will always yield the same result (only with Ubuntu's 0.9.8k though) when running make test-all TESTS="openssl/test_pair.rb": ..................# Iteration: 441 E. Finished tests in 1.213241s, 16.4848 tests/s, 83.2481 assertions/s. 1) Error: test_write_nonblock(OpenSSL::TestPair): OpenSSL::SSL::SSLError: SSL_read:: bad write retry /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:53:in `sysread' /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:53:in `fill_rbuff' /home/martin/Projekte/Ruby/ruby-svn/build/.ext/common/openssl/buffering.rb:94:in `read' /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:188:in `block in test_write_nonblock' /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:44:in `ssl_pair' /home/martin/Projekte/Ruby/ruby-svn/ruby/test/openssl/test_pair.rb:164:in `test_write_nonblock' 20 tests, 101 assertions, 0 failures, 1 errors, 0 skips It always flunks at iteration 441 with an "OpenSSL::SSL:SSLError: write would block". ---------------------------------------- Bug #4923: [ext/openssl] test_ssl.rb: test_client_auth fails http://redmine.ruby-lang.org/issues/4923 Author: Martin Bosslet Status: Open Priority: Low Assignee: Hiroshi Nakamura Category: ext Target version: 1.9.3 ruby -v: ruby 1.9.3dev (2011-06-13 trunk 32213) [i686-linux] Hi, I was finally able to reproduce this with Fedora 15 32 bit, OpenSSL 1.0.0d. The error occurs only when running make test-all TESTS="openssl", if I run test_ssl.rb independently the test succeeds. Here is the output I get: 1) Error: test_client_auth(OpenSSL::TestSSL): OpenSSL::SSL::SSLError: SSL_read:: sslv3 alert bad record mac /home/martin/Projekte/Ruby/build/.ext/common/openssl/buffering.rb:53:in `sysread' /home/martin/Projekte/Ruby/build/.ext/common/openssl/buffering.rb:53:in `fill_rbuff' /home/martin/Projekte/Ruby/build/.ext/common/openssl/buffering.rb:200:in `gets' /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl.rb:118:in `block in test_client_auth' /home/martin/Projekte/Ruby/ruby/test/openssl/utils.rb:280:in `call' /home/martin/Projekte/Ruby/ruby/test/openssl/utils.rb:280:in `start_server' /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl.rb:103:in `test_client_auth' Related to #4919. Regards, Martin -- http://redmine.ruby-lang.org