Issue #4923 has been updated by Martin Bosslet.


Oops, the n += 1 was misplaced indeed :)

I tried on Fedora 15 with the official 0.9.8k and was able to reproduce the error in 'test_write_non_block'. Closing sockets s1 and s2 in the ensure block in 'test_connect_accept_nonblock' unfortunately didn't help, still the same error (running the tests normally).
 
Next, I tested with 0.9.8o (official download) and *wasn't* able to reproduce it (again Fedora 15 32 bit) - in contrast to your experience. 

0.9.8k: Fails
0.9.8l: Fails
0.9.8m: Succeeds
0.9.8n: Succeeds
0.9.8o: Succeeds
0.9.8r: Succeeds
1.0.0d: Succeeds

So it seems that on my side I'm able to reproduce it deterministically with 0.9.8k and 0.9.8l, but the failure vanishes in versions >= 0.9.8m.

I scanned through OpenSSL's change log looking for changes made in 0.9.8m and found this:

Handle non-blocking I/O properly in SSL_shutdown() call.
     [Darryl Miles <darryl-mailinglists / netbauds.net>]

The behavior on my machine would underline the assumption that this is probably the cause. What do you think? Should I try to find out exactly what Darryl Miles changed to see whether we could handle this in ext/openssl, too?
----------------------------------------
Bug #4923: [ext/openssl] test_ssl.rb: test_client_auth fails
http://redmine.ruby-lang.org/issues/4923

Author: Martin Bosslet
Status: Open
Priority: Normal
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