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

Getting FunctionClauseError from Ecto.Adapters.SQL.Sandbox.Pool.disconnect/4 in Ecto 2.0.1 #1512

Closed
myronmarston opened this issue Jun 24, 2016 · 1 comment

Comments

@myronmarston
Copy link
Contributor

Environment

  • Elixir version (elixir -v):
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.3.0
  • Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.):
MySQL Server version: 5.6.25-73.1 Homebrew
  • Ecto version (mix deps):
  "ecto": {:hex, :ecto, "2.0.1", "cf97a4d353e14af3d3cc3b4452cfbd18b3aeee1fb4075475efeccec3853444a9", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: true]}, {:sbroker, "~> 1.0-beta", [hex: :sbroker, optional: true]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:postgrex, "~> 0.11.2", [hex: :postgrex, optional: true]}, {:db_connection, "~> 1.0-rc.2", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}]},
  • Database adapter and version (mix deps):
  "mariaex": {:hex, :mariaex, "0.7.7", "620a636ec2276c3fa031ac528039fc9d2bf7992e050e37a56b3c796511e94d6d", [:mix], [{:db_connection, "~> 1.0.0-rc", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]},
  • Operating system:

OS X El Capitan

Current behavior

In my tests, I periodically get this error:

     ** (exit) exited in: GenServer.call(#PID<0.21338.0>, {:checkout, #Reference<0.0.1.249038>, true, 15000}, 5000)
         ** (EXIT) an exception was raised:
             ** (FunctionClauseError) no function clause matching in Ecto.Adapters.SQL.Sandbox.Pool.disconnect/4
                 (ecto) lib/ecto/adapters/sql/sandbox.ex:371: Ecto.Adapters.SQL.Sandbox.Pool.disconnect({#PID<0.2872.0>, #PID<0.2875.0>, {#PID<0.2875.0>, #Reference<0.0.1.248995>}}, %DBConnection.ConnectionError{message: "client #PID<0.21347.0> exited with: no process"}, {Mariaex.Protocol, %Mariaex.Protocol{buffer: "", cache: 9166937, catch_eof: false, connection_id: #PID<0.2875.0>, connection_ref: #Reference<0.0.2.15580>, lru_cache: {100, 9171034}, opts: [socket_options: [], sock_type: :tcp, cache_size: 100, pool: DBConnection.Poolboy, otp_app: :legion, repo: Delorean.Legion.Shard0Repo, adapter: Ecto.Adapters.MySQL, hostname: "127.0.0.1", database: "legion_shard_0_test", username: "root", password: nil, pool_timeout: 5000, timeout: 15000, adapter: Ecto.Adapters.MySQL, port: 3306], protocol57: false, rows: [], seqnum: 0, sock: {Mariaex.Connection.Tcp, #Port<0.44114>}, state: :running, state_data: {0, 0}, timeout: 15000}, false}, [timeout: :infinity, repo: Delorean.Legion.Shard0Repo, sandbox_pool: DBConnection.Poolboy, ownership_pool: Ecto.Adapters.SQL.Sandbox.Pool, pool_timeout: 5000, adapter: Ecto.Adapters.MySQL, pool: DBConnection.Ownership])
                 (db_connection) lib/db_connection/ownership/proxy.ex:242: DBConnection.Ownership.Proxy.disconnect/2
                 (stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
                 (stdlib) gen_server.erl:681: :gen_server.handle_msg/5
                 (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
     stacktrace:
       (db_connection) lib/db_connection/ownership/proxy.ex:32: DBConnection.Ownership.Proxy.checkout/2
       (db_connection) lib/db_connection.ex:716: DBConnection.checkout/2
       (db_connection) lib/db_connection.ex:623: DBConnection.run/3
       (db_connection) lib/db_connection.ex:464: DBConnection.prepare_execute/4
       (ecto) lib/ecto/adapters/mysql/connection.ex:32: Ecto.Adapters.MySQL.Connection.execute/4
       (ecto) lib/ecto/adapters/sql.ex:228: Ecto.Adapters.SQL.sql_call/6
       (ecto) lib/ecto/adapters/sql.ex:178: Ecto.Adapters.SQL.query!/5

It works when I retry, so I can't consistently reproduce.

Expected behavior

The error should not happen, unless it's due to some problem I'm not aware of with how we are using Ecto in our tests -- in which case, it should give me an error explaining what I'm doing wrong.

@josevalim
Copy link
Member

It is already fixed in master and I just pushed a test, thank you! :)

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

No branches or pull requests

2 participants