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::SSL::SSLError: SSL_write: unsupported method #738

Open
hari-sangani opened this issue Mar 28, 2024 · 4 comments
Open

OpenSSL::SSL::SSLError: SSL_write: unsupported method #738

hari-sangani opened this issue Mar 28, 2024 · 4 comments

Comments

@hari-sangani
Copy link

hari-sangani commented Mar 28, 2024

Hello 👋

When establishing a connection to Azure Cache for Redis using ssl option, encountering this error.

OpenSSL::SSL::SSLError: SSL_write: unsupported method
from openssl/buffering.rb:415:in 'syswrite_nonblock'
from openssl/buffering.rb:415:in 'write_nonblock'
from redis-client (0.20.0) lib/redis_client/ruby_connection/buffered_io.rb:64:in 'block in write'
from redis-client (0.20.0) lib/redis_client/ruby_connection/buffered_io.rb:63:in 'loop'
from redis-client (0.20.0) lib/redis_client/ruby_connection/buffered_io.rb:63:in 'write'
from redis-client (0.20.0) lib/redis_client/ruby_connection.rb:74:in 'write'
from redis-client (0.20.0) lib/redis_client/connection_mixin.rb:30:in 'call'
from redis-client (0.20.0) lib/redis_client.rb:272:in 'block (2 levels) in call_v'
from redis-client (0.20.0) lib/redis_client/middlewares.rb:16:in 'call'
from redis-client (0.20.0) lib/redis_client.rb:271:in 'block in call_v'
from redis-client (0.20.0) lib/redis_client.rb:677:in 'ensure_connected'
from redis-client (0.20.0) lib/redis_client.rb:270:in 'call_v'
from redis (5.1.0) lib/redis/client.rb:90:in 'call_v'
from redis (5.1.0) lib/redis.rb:152:in 'block in send_command'
from redis (5.1.0) lib/redis.rb:151:in 'synchronize'
from redis (5.1.0) lib/redis.rb:151:in 'send_command'
from redis (5.1.0) lib/redis/commands/strings.rb:191:in 'get'
from activesupport (6.1.7.3) lib/active_support/cache/redis_cache_store.rb:349:in 'block (2 levels) in read_entry'
from redis (5.1.0) lib/redis.rb:95:in 'with'
from activesupport (6.1.7.3) lib/active_support/cache/redis_cache_store.rb:349:in 'block in read_entry'
from activesupport (6.1.7.3) lib/active_support/cache/redis_cache_store.rb:478:in 'failsafe'
from activesupport (6.1.7.3) lib/active_support/cache/redis_cache_store.rb:347:in 'read_entry'
from activesupport (6.1.7.3) lib/active_support/cache/strategy/local_cache.rb:136:in 'block in read_entry'
from activesupport (6.1.7.3) lib/active_support/cache/strategy/local_cache.rb:78:in 'block in fetch_entry'
from activesupport (6.1.7.3) lib/active_support/cache/strategy/local_cache.rb:78:in 'fetch'
from activesupport (6.1.7.3) lib/active_support/cache/strategy/local_cache.rb:78:in 'fetch_entry'
from activesupport (6.1.7.3) lib/active_support/cache/strategy/local_cache.rb:134:in 'read_entry'
from activesupport (6.1.7.3) lib/active_support/cache.rb:333:in 'block in fetch'
from activesupport (6.1.7.3) lib/active_support/cache.rb:726:in 'block in instrument'
from activesupport (6.1.7.3) lib/active_support/notifications.rb:203:in 'block in instrument'
from activesupport (6.1.7.3) lib/active_support/notifications/instrumenter.rb:24:in 'instrument'
from activesupport (6.1.7.3) lib/active_support/notifications.rb:203:in 'instrument'
from activesupport (6.1.7.3) lib/active_support/cache.rb:726:in 'instrument'
from activesupport (6.1.7.3) lib/active_support/cache.rb:332:in 'fetch'

Redis 6.0.4
OpenSSL 3.0.11
Ruby 3.1.1
Rails 6.1.7.3

@rhenium
Copy link
Member

rhenium commented Apr 26, 2024

Is there any way to reproduce the error? Do you happen to use an OpenSSL engine or provider?

The error message "unsupported method" likely belongs to OpenSSL BIO API, but it doesn't seem to be normal to appear here.

@hari-sangani
Copy link
Author

This issue occasionally occurs while connecting to the Redis server on Azure, but it works fine when using OpenSSL version 1.1.1w.

@rhenium
Copy link
Member

rhenium commented May 8, 2024

Could you provide a reproducer that I can run? The error message is unusual and I want to look into it.

@hari-sangani
Copy link
Author

To reproduce the error, you'll need to set up a Redis server that requires an SSL connection, such as Azure Redis Cache(set ssl=true here). Configure your project to connect to this Redis instance.

For example, you can use the latest Docker image for Ruby 3.1, which includes OpenSSL version 3.0.9, and attempt to execute a fetch command, you might encounter the error.

If it succeeds initially, wait for 5-10 minutes, then execute the same command again. You should encounter the error at that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants