Issue #4923 has been updated by Martin Bosslet.

Assignee set to Hiroshi NAKAMURA

I played around a bit and it seems like this could be some kind of race condition.
At first I thought that the custom Fedora OpenSSL would probably reject some
algorithm and so I wanted to see what cipher is negotiated in the tests and added
this:

Index: test/openssl/utils.rb
===================================================================
--- test/openssl/utils.rb	(revision 32218)
+++ test/openssl/utils.rb	(working copy)
@@ -226,6 +226,7 @@
         ssl = nil
         begin
           ssl = ssls.accept
+          puts ssl.cipher
         rescue OpenSSL::SSL::SSLError
           retry
         end


This actually made the test failure disappear.

It also disappears if I leave some of the openssl tests out, e.g.
if I leave out the first test test_asn.rb or test_cipher.rb - this will
also cause test_ssl.rb to succeed. What bugs me is that these tests 
aren't related to test_ssl.rb except maybe for the fact that they all
"require openssl" and utils.rb. Could it be that something persists in 
the buffer used for the SSL tests that is introduced by any of the other tests?

It's really weird... Hiroshi, do you have an idea what the cause might
be?

I would tend to ignore this since it only appears with a customized
OpenSSL version in a very specific scenario if it weren't for the
fact that I'm afraid if really a race condition is the problem then
this could also come up again in other situations...

Thanks in advance,
Martin
----------------------------------------
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: 
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