Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tds.Tls.assert_connected MatchError with Dynamic repositories #170

@user20230119

Description

@user20230119

I get the following error when I use dynamic repositories.

defmodule MyApp.Repo do
  use Ecto.Repo, ...

  def with_dynamic_repo(credentials, callback) do
    default_dynamic_repo = get_dynamic_repo()
    start_opts = [name: nil, pool_size: 1] ++ credentials
    {:ok, repo} = MyApp.Repo.start_link(start_opts)

    try do
      MyApp.Repo.put_dynamic_repo(repo)
      callback.()
    after
      MyApp.Repo.put_dynamic_repo(default_dynamic_repo)
      Supervisor.stop(repo)
    end
  end
end
[error] :gen_statem #PID<0.5109.0> terminating
** (MatchError) no match of right hand side value: nil
    (tds 2.3.5) lib/tds/tls.ex:86: Tds.Tls.assert_connected!/1
    (tds 2.3.5) lib/tds/tls.ex:41: Tds.Tls.send/2
    (ssl 11.2.10) tls_sender.erl:516: :tls_sender.send_tls_alert/2
    (ssl 11.2.10) tls_sender.erl:294: :tls_sender.connection/3
    (stdlib 6.2.2) gen_statem.erl:3735: :gen_statem.loop_state_callback/11
    (stdlib 6.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Process Label: {:tls_sender, :client, {:connection, #PID<0.5114.0>}}
Queue: [{{:call, {#PID<0.5114.0>, [:alias | #Reference<0.0.654595.1328173062.509673475.196404>]}}, {:ack_alert, {:alert, 1, 0, %{line: 1929, file: ~c"ssl_gen_statem.erl", mfa: {:ssl_gen_statem, :terminate_alert, 1}}, :undefined, :undefined}}}]
Postponed: []
State: {:connection, {:data, {:env, #PID<0.5114.0>, :client, #Port<0.533>, {:socket_options, :binary, 0, 0, 0, false}, false, :undefined, Tds.Tls, {3, 3}, 268435456, 388736063997, :undefined, :notice, :infinity, :undefined, 0}, ...
Callback mode: :state_functions, state_enter: false
Client #PID<0.5114.0> is alive

    (stdlib 6.2.2) gen.erl:260: :gen.do_call/4
    (stdlib 6.2.2) gen_statem.erl:3250: :gen_statem.call/3
    (ssl 11.2.10) tls_gen_connection.erl:553: :tls_gen_connection.send_sync_alert/2
    (ssl 11.2.10) ssl_gen_statem.erl:1255: :ssl_gen_statem.terminate/3
    (stdlib 6.2.2) gen_statem.erl:4911: :gen_statem.terminate/7
    (ssl 11.2.10) tls_client_connection.erl:156: :tls_client_connection.init/1
    (stdlib 6.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
[error] :gen_statem #PID<0.5102.0> terminating
** (MatchError) no match of right hand side value: nil
    (tds 2.3.5) lib/tds/tls.ex:86: Tds.Tls.assert_connected!/1
    (tds 2.3.5) lib/tds/tls.ex:41: Tds.Tls.send/2
    (ssl 11.2.10) tls_sender.erl:516: :tls_sender.send_tls_alert/2
    (ssl 11.2.10) tls_sender.erl:294: :tls_sender.connection/3
    (stdlib 6.2.2) gen_statem.erl:3735: :gen_statem.loop_state_callback/11
    (stdlib 6.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Process Label: {:tls_sender, :client, {:connection, #PID<0.5106.0>}}
Queue: [{{:call, {#PID<0.5106.0>, [:alias | #Reference<0.0.653571.1328173062.509673478.130217>]}}, {:ack_alert, {:alert, 1, 0, %{line: 1929, file: ~c"ssl_gen_statem.erl", mfa: {:ssl_gen_statem, :terminate_alert, 1}}, :undefined, :undefined}}}]
Postponed: []
State: {:connection, {:data, {:env, #PID<0.5106.0>, :client, #Port<0.535>, {:socket_options, :binary, 0, 0, 0, false}, false, :undefined, Tds.Tls, {3, 3}, 268435456, 388736063997, :undefined, :notice, :infinity, :undefined, 0}, ...
Callback mode: :state_functions, state_enter: false
Client #PID<0.5106.0> is alive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions