elixir-ecto / db_connection

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

Fix ownership caller to use caller on auto/shared #79

Closed fishcakez closed 7 years ago

fishcakez commented 7 years ago

Always use :caller when option is set, and fail if :caller does not have a proxy.

We should release patch to fix this issue. A caller process will get a new proxy in :auto mode regardless of caller and will get the proxy of owner in {:shared, owner} even if caller is not owner.

josevalim commented 7 years ago

A caller process will get a new process in :auto mode regardless of caller and will get the proxy of owner in {:shared, owner} even if caller is not owner.

What does it mean in practice? Some process may get a connection outside of the specified sandbox?

fishcakez commented 7 years ago

What does it mean in practice? Some process may get a connection outside of the specified sandbox?

Does the edit to the top comment clear this up?

The easiest example is to use parallel preload in Ecto with :auto mode. The preload tasks will get their own sandbox. This requires 2 or more preloads.