Skip to content
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

OpenSSL::TestSSLSession#test_ctx_client_session_cb_tls13_exception fails on i686 #828

Closed
voxik opened this issue Dec 20, 2024 · 8 comments · Fixed by #829
Closed

OpenSSL::TestSSLSession#test_ctx_client_session_cb_tls13_exception fails on i686 #828

voxik opened this issue Dec 20, 2024 · 8 comments · Fixed by #829

Comments

@voxik
Copy link

voxik commented Dec 20, 2024

Trying Ruby 3.4 335bba0fde, I am observing following failure on i686:

OpenSSL::TestSSLSession#test_ctx_client_session_cb_tls13_exception [/builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:290]:
exceptions on 1 threads:
#<Thread:0xf3c80958 /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:247 dead>:
/builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:364:in 'OpenSSL::SSL::SSLSocket#syswrite': Connection reset by peer (Errno::ECONNRESET)
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:364:in 'OpenSSL::Buffering#do_write'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:383:in 'block in OpenSSL::Buffering#write'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:382:in 'Array#each'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:382:in 'Enumerable#inject'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/redhat-linux-build/.ext/common/openssl/buffering.rb:382:in 'OpenSSL::Buffering#write'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:203:in 'OpenSSL::SSLTestCase#readwrite_loop'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:251:in 'Method#call'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:251:in 'block (4 levels) in OpenSSL::SSLTestCase#start_server'

This is recently introduced test case as far as I can tell:

ruby/ruby@06fc13a

rhenium added a commit to rhenium/ruby-openssl that referenced this issue Dec 20, 2024
In the test case, the client raises an exception in the session_new_cb
and may not cleanly close the connection. Let's ignore exceptions raised
at the server side.

Fixes: ruby#828
@rhenium
Copy link
Member

rhenium commented Dec 20, 2024

The server side error is expected and should be ignored. #829 should fix it.

@voxik
Copy link
Author

voxik commented Dec 20, 2024

Thx. But I wonder why i686 only? x86_64, arm64, ppc64le as well as s390x are passing just fine.

@voxik
Copy link
Author

voxik commented Dec 20, 2024

I could have made some mistake, but the error is still the same even with the patch applied.

@junaruga
Copy link
Member

junaruga commented Dec 20, 2024

Seeing the trace log on the first comment, the Errno::ECONNRESET is raised in the OpenSSL::SSLTestCase#readwrite_loop in the server_proc.call(ctx, ssl), at the following line in OpenSSL::SSLTestCase#start_server.

https://github.com/ruby/ruby/blob/335bba0fde0c0407377b6e10050ab6c2ad0d3270/test/openssl/utils.rb#L251

The PR #829 is adding the option ignore_listener_error: true to the called start_server. However, the option is only to retry accept_proc.call(ssl) which is before the server_proc.call(ctx, ssl). So, I don't think the PR #829 can catch the reported error from the server_proc.call(ctx, ssl).

	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:203:in 'OpenSSL::SSLTestCase#readwrite_loop'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:251:in 'Method#call'
	from /builddir/build/BUILD/ruby-3.4.0_20241219git335bba0fde-build/ruby-3.4.0-335bba0fde/test/openssl/utils.rb:251:in 'block (4 levels) in OpenSSL::SSLTestCase#start_server'

rhenium added a commit to rhenium/ruby-openssl that referenced this issue Dec 20, 2024
In the test case, the client raises an exception in the session_new_cb
and may not cleanly close the connection. Let's ignore exceptions raised
at the server side.

Fixes: ruby#828
@rhenium
Copy link
Member

rhenium commented Dec 20, 2024

You're right. The error happens after the connection is established, for which ignore_listener_error has no effect.

@voxik Could you try with the new diff?

@voxik
Copy link
Author

voxik commented Dec 20, 2024

I have kicked off build here:

https://koji.fedoraproject.org/koji/taskinfo?taskID=127060441

and once done, this will be the i686 build log specifically:

https://kojipkgs.fedoraproject.org//work/tasks/550/127060550/build.log

@voxik
Copy link
Author

voxik commented Dec 20, 2024

The test has passed 👏

@rhenium
Copy link
Member

rhenium commented Dec 21, 2024

Thanks for checking. I've merged it now.

rhenium added a commit to rhenium/ruby that referenced this issue Dec 21, 2024
…s13_exception

In the test case, the client raises an exception in the session_new_cb
and may not cleanly close the connection. Let's ignore exceptions raised
at the server side.

Fixes: ruby/openssl#828

ruby/openssl@210ba0334a
rhenium added a commit to rhenium/ruby that referenced this issue Dec 21, 2024
…s13_exception

In the test case, the client raises an exception in the session_new_cb
and may not cleanly close the connection. Let's ignore exceptions raised
at the server side.

Fixes: ruby/openssl#828

ruby/openssl@210ba0334a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants