CastLouis

CastLouis

i have a process that i want to modify the conection timeout in ecto, but it still wit the same conection time out this is the error:

[error] Postgrex.Protocol (pid<0.319.0>) disconnected: ** (DBConnection.ConnectionError) owner pid<0.481.0> timed out because it owned the connection for longer than 15000ms

(DBConnection.ConnectionError) tcp send: closed

Showing Posts 1 to 10

Eiji

Eiji

@CastLouis: Did you checked this article? It’s guide for probably what you want.

CastLouis

CastLouis OP

i check my configurations and looks like in the example, the problem is that when i run the process it took more time than 15ms, and i modify the conection timeout in test.exs and in all the files and it doesn’t work.

Eiji

Eiji

@CastLouis: It looks like another problem with (default?) configuration - ping @josevalim and @fishcakez.

To be sure, please update your dependencies (especially Ecto and Postgrex).

Please also give us some info:

  1. Your OS and source of Erlang and Elixir you use like: Distro Name - Version - default/name of repo
  2. Erlang and Elixir versions
  3. Your dependencies version (again especially Ecto and Postgrex)
  4. Your database version
  5. If possible please share a minimal example to reproduce your problem with timeout
josevalim

josevalim

Creator of Elixir

Thanks @Eiji.

Keep in mind that the ownership timeout is controlled by the :ownership_timeout configuration. I think we improve the error message for it in more recent versions as well.

CastLouis

CastLouis OP

Good morning
i was loading a .csv file with a lot of registry, it took a lot of time to complete, while it loading the

code of loading the file
defp parse_line_to_string(line) do
<<code::binary-size(2), _::binary-size(1), rest::binary>> = line
{code, rest}
end

the code to insert into the database:

defp parse_line_to_string(line) do
<<code::binary-size(2), _::binary-size(1), rest::binary>> = line
{code, rest}
end

#the configuration from ecto:
config :na_db,
ecto_repos: [NA.DB.Repo]

config :na_db, NA.DB.Repo,
adapter: Ecto.Adapters.Postgres,
database: “nadb”,
username: “dadmin”,
password: “d@dm!n”,
hostname: “127.0.0.1”,
pool: Ecto.Adapters.SQL.Sandbox,
port: “5432”,
timeout: 450000

i was changing and use :ownership_timeout and set more time and it doesn’t work.

Eiji

Eiji

I tried to simulate similar work (collecting data for more than 15s) and I got same error, however Supervisor for MyApp.Repo saves tests from not passing and I checked also database and all works! Elixir is just awesome!

@josevalim: Thanks! I added it to configuration and it still works same, but without errors like in this topic. I agree that we need a better error message, because I also through about other timeout configuration variables.
I have a question that is related to this topic. Is it safe to set much more bigger timeouts in configuration than default one or we need to accept some consequences? Imagine new blog will probably be rarely visited and that surprise of Elixir admin that it have a error every 15s :smiley:

@CastLouis: Make sure that you are changing it in right configuration file and be sure to follow all steps in tutorial I previously linked. As I already wrote I got same error in example application and solved it using both tutorial and José tip.

CastLouis

CastLouis OP

i was modifing the postgrex.ex, the property @timeout with more time, but the problem still,

Eiji

Eiji

@CastLouis: What you mean by postgrex.ex? You need to change configuration *.exs file in /config directory. Depends on environment that you are working on you should apply configuration change in appropriate configuration file like: test.exs.
Example config/test.exs file:

use Mix.Config

config :my_app, MyApp.Repo,
  adapter: Ecto.Adapters.Postgres,
  database: "my_app_test",
  hostname: "localhost",
  ownership_timeout: 60_000, # <- add this line
  password: "postgres",
  pool: Ecto.Adapters.SQL.Sandbox,
  username: "postgres"
CastLouis

CastLouis OP

i was modify postgrex @timeout property for chech, i was modifing the test.exs with ownership_timeout, pool_timeout and timeout too, but the problem persist and i dont know how can i find more information about it, i think the reset the machine if ecto see the changes let me.

Eiji

Eiji

@CastLouis: You missed something. Checked again Ecto tutorial step by step and be sure to add :ownership_timeout to test.exs. If you can publish your code or invite me to repository then I can fix it for you - I will create a PR. I have accounts on Github, BitBucket and GitLab

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews