elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Improve context for timeout errors #277

Closed LostKobrakai closed 1 year ago

LostKobrakai commented 1 year ago

Since #195 there is the stacktrace of the caller logged before a timeout error. However it seems that the space of those errors is completly taken up by db_connection and in the case I'm looking at postgrex callpaths, which don't really help debug any issues:

[error] Postgrex.Protocol (#PID<0.4151.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.14790.286> timed out because it queued and checked out the connection for longer than 15000ms
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod #PID<0.14790.286> was at location:
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     :prim_inet.recv0/3
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (postgrex 0.16.3) lib/postgrex/protocol.ex:3108: Postgrex.Protocol.msg_recv/4
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (postgrex 0.16.3) lib/postgrex/protocol.ex:2138: Postgrex.Protocol.recv_bind/3
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (postgrex 0.16.3) lib/postgrex/protocol.ex:2030: Postgrex.Protocol.bind_execute/4
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (db_connection 2.4.2) lib/db_connection/holder.ex:354: DBConnection.Holder.holder_apply/4
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (db_connection 2.4.2) lib/db_connection.ex:1364: DBConnection.run_execute/5
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (db_connection 2.4.2) lib/db_connection.ex:1459: DBConnection.run/6
Mar 02 05:42:01 54.227.167.197 nerves-hub-web-device-prod     (db_connection 2.4.2) lib/db_connection.ex:652: DBConnection.execute/4

I'm wondering if it would be useful here or in direct dependencies to bump the stacktrace depth of the error.

josevalim commented 1 year ago

the stacktrace depth bump is global, so you have to do it yourself. :( nothing we can do here.