elixir-ecto / db_connection

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

Potentially misleading log from client or owner exit in ownership pool #37

Closed fishcakez closed 8 years ago

fishcakez commented 8 years ago

This is a pretty classic 3-way exit signal race condition where we technically log the wrong reason:

OR

Fortunately we disconnect in either case so the pool is secure. However it might be that we can give better information or at least try to prevent a user from being mislead that a different process caused the crash.

When we have 2 monitors active (one on owner and one on client) and we receive a :DOWN we could use Process.alive? to see if the other process is still alive and use this in the message. If the other process is not alive we can block to receive their :DOWN and log both. If the process is alive it might be helpful to add that information to (e.g. "(with client #PID<..>)"). We may also want to special case the situation where the owner is the client.

fishcakez commented 8 years ago

@josevalim do you think this is worth looking into otherwise will close?

josevalim commented 8 years ago

I vote for close, yes. :)