Occasionally SSL_connect error? appears.

Asked 2 years ago, Updated 2 years ago, 46 views

As the title says, when I run the program on ruby, it usually works fine, but sometimes I get the following error and it stops working.

 C:/Ruby26-x64/lib/ruby/2.6.0/net/protocol.rb:44:in `connect_nonblock': An existing connection was forced closed by the remote host. - SSL_connect (Errno:: ECONNRESET)

C:/Ruby26-x64/lib/ruby/2.6.0/net/protocol.rb:44:in `connect_nonblock': An existing connection was forced closed by the remote host. - SSL_connect (Faraday::ConnectionFailed)

I looked it up myself, but I couldn't find the answer...
As a beginner, I don't know what the cause is because it works normally.
Perhaps I am lacking in knowledge, but I would like you to tell me how to solve this problem.

You may not need it, but the following cases.connect_nonblock(exception: false) is part 44 of protocol.rb.

def ssl_socket_connect(s,timeout)
      if timeout
        while true
          raise Net::OpenTimeout if timeout<=0
          start=Process.clock_gettimeProcess::CLOCK_MONOTONIC
          # to_io is required cause SSLSocket does not have wait_readable yet
          cases.connect_nonblock (exception: false)
          when —wait_readable; s.to_io.wait_readable(timeout)
          when —wait_writeable; s.to_io.wait_writeable(timeout)
          else;break
          end
          timeout -=Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
        end
      else
        s.connect
      end
    end
  end

The operating system is Windows 10.

ruby

2022-09-30 19:49

1 Answers

Is the SSL version appropriate?

For example, if the server only accepts TLS v1.2, but the client connects with SSL V3.0 to TLS v1.0, the error should be returned, but some servers suddenly disconnect.


2022-09-30 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.