mssqlex icon indicating copy to clipboard operation
mssqlex copied to clipboard

Random (Mssqlex.Error) connection_closed

Open pcharbon70 opened this issue 5 years ago • 0 comments

We are randomly getting some connection_closed as an Mssqlex.Error when doing any insertion into the database. Whether it is a simple Repo.insert or an Ecto.multi in a transaction this seems to happen randomly but on a very noticeable frequency. From the error message (see below) it seems that this is coming from the Db_Connection pool.

Error example

[error] #PID<0.453.0> running CmiserverWeb.Endpoint (cowboy_protocol) terminated Server: localhost:4000 (http) Request: POST /api/v1/auth/checkout/submitorder ** (exit) an exception was raised: ** (Mssqlex.Error) connection_closed (db_connection) lib/db_connection.ex:802: DBConnection.transaction/3 (ecto) lib/ecto/repo/queryable.ex:21: Ecto.Repo.Queryable.transaction/4

Context

All the querying seems to work fine even on long queries and does not seem to be affected at all by these timeouts. We tried so far to increase both the the :pool_size and the :timeout on the Ecto.Repo configuration but that did not improve or seem to have any effect at all. I can't figure out why the queries would not timeout but all insertions do.

Our Environment

  • MssqlEcto version: 1.2.0
  • Ecto version: 2.2.0
  • Elixir version: 1.7.4
  • Erlang version: 20.2
  • Microsoft SQL Server version: SQL Server 2016
  • Operating System and version: Windows Server 2012 R2

Any suggestion at where to look next while trying to figure this out would also be appreciated.

Thank you

pcharbon70 avatar Feb 28 '19 12:02 pcharbon70