Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1136

shutdown,own_alert and tcp_error/tls_alert/bad_record_mac when calling setopts on a closing socket

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: OTP 22.2, OTP-22.2.1
    • Fix Version/s: OTP-22.2.4
    • Component/s: ssl
    • Labels:

      Description

      Followup from ERL-1116 - Happening on OTP 22.2.1

      We're seeing a crash error logged occasionally (possible race) on an ssl connection when the server sends a packet and then immediately closes the connection.

      Our code uses active, once whenever a new packet is received for control flow, so we call this when receiving the packet, which may be the trigger.

      ssl:setopts(Socket, [{active, once}])

       

      This is the logged error from the crash.

      tls_connection:handle_protocol_record:296 gen_statem <0.3706.0> in state data terminated with reason: no match of right hand value {stop,{shutdown,own_alert},{state,{static_env,client,gen_tcp,tls_connection,tcp,tcp_closed,tcp_error,tcp_passive,{23,239,20,207},6697,#Port<0.3247>,#Ref<0.3521618910.3149791236.189561>,#Ref<0.3521618910.3149791236.189566>,ssl_session_cache,{ssl_crl_cache,{{#Ref<0.3521618910.3149791236.189564>,#Ref<0.3521618910.3149791236.189565>},[]}},{#Ref<0.3521618910.3149791236.189562>,#Ref<0.3521618910.3149791236.189563>},#Ref<0.3521618910.3149660162.192095>,undefined},{connection_env,{#Ref<0.3521618910.3149922306.37893>,...},...},...}} in tls_connection:handle_protocol_record/3 line 296

      at the same time, the following message is sent to the controlling process:

      {tcp_error, Sock, {tls_alert,{bad_record_mac,"TLS client: In state connection received UNDEFINED ALERT: Fatal - Bad Record MAC\n "}}}

        Attachments

          Activity

            People

            Assignee:
            otp_team_ps Team PS
            Reporter:
            jwheare James Wheare
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: