Skip to content

Error: can't modify frozen OpenSSL::SSL::SSLContext #144

@MaffooClock

Description

@MaffooClock

I'm using this library to connect to AWS IoT -- works great! However, from time to time, I guess there's some sort of disruption in the connection (don't really have any good guesses on what those causes might be), and eventually my STDOUT is full of messages like this (because my script is attempting to reconnect):

Error: can't modify frozen OpenSSL::SSL::SSLContext: #<OpenSSL::SSL::SSLContext:0x000000010e4c0f90
    @verify_mode=1,
    @verify_hostname=false,
    @ca_file="services/../lib/ssl/aws-ca1.crt",
    @cert=#<OpenSSL::X509::Certificate:
        subject=#<OpenSSL::X509::Name CN=AWS IoT Certificate>,
        issuer=#<OpenSSL::X509::Name OU=Amazon Web Services O=Amazon.com Inc. L=Seattle ST=Washington C=US>, 
        serial=#<OpenSSL::BN:0x000000010e916cc0>, not_before=2022-05-04 14:24:53 UTC, not_after=2049-12-31 23:59:59 UTC
    >,
    @key=#<OpenSSL::PKey::RSA:0x000000010e4c05e0 oid=rsaEncryption>,
    @max_proto_version=771,
    @min_proto_version=771
>

The fix is simply to terminate the script and restart it, and it works fine again.

Is this gem leaving something dirty on the connection? Or is it my OpenSSL version? Or...?

$ ruby -v      
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

$ gem info mqtt

*** LOCAL GEMS ***

mqtt (0.5.0)
    Author: Nicholas J Humfrey
    Homepage: http://github.com/njh/ruby-mqtt
    License: MIT
    Installed at: /Users/mclark/.rvm/gems/ruby-3.1.2

    Implementation of the MQTT protocol

$ openssl version
LibreSSL 2.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions