Giter Site home page Giter Site logo

Comments (6)

zuiderkwast avatar zuiderkwast commented on August 18, 2024

no match of right hand value {error,closed} in mysql_protocol:ping/2

It seems that the server has closed the connection because of inactivity when it receives the ping. Maybe the server variable wait_timeout is shorter than the mysql-otp keepalive (ping) timeout?

from mysql-otp-poolboy.

retf avatar retf commented on August 18, 2024

Hello, I am having a similar problem! Is it related? Would anyone know how to solve?

iex([email protected])2>
03:53:47.394 [error] Connection Id 175396507 closing with reason: :tcp_closed

03:53:47.390 [error] Connection Id 175396507 closing with reason: tcp_closed
03:53:47.396 [error] gen_server <0.2828.0> terminated with reason: tcp_closed

03:53:47.411 [error] GenServer #PID<0.2828.0> terminating
** (stop) :tcp_closed
Last message: {:tcp_closed, #Port<0.52>}
State: {:state, [5, 5, 61], :undefined, :undefined, :gen_tcp, :undefined, 'test.sa-east-1.rds.amazonaws.com', 3306, 'test', 'testtest', <<114, 91, 84, 113, 90, 82, 107, 68, 79, 67, 63, 83, 98, 113, 53, 81, 117, 125, 50, 33, 0>>, true, :infinity, :infinity, 60000, 0, 2, 0, 0, [], :undefined, {:dict, 0, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}}}, :empty, false}
03:53:47.412 [error] CRASH REPORT Process <0.2828.0> with 0 neighbours exited with reason: tcp_closed in gen_server:handle_common_reply/8 line 751
03:53:47.412 [error] Supervisor {<0.2827.0>,poolboy_sup} had child mysql started with {mysql,start_link,undefined} at <0.2828.0> exit with reason tcp_closed in context child_terminated

03:53:51.225 [error] Connection Id 175396508 closing with reason: :tcp_closed

03:53:51.226 [error] GenServer #PID<0.2832.0> terminating
** (stop) :tcp_closed
Last message: {:tcp_closed, #Port<0.53>}
State: {:state, [5, 5, 61], :undefined, :undefined, :gen_tcp, :undefined, 'test.sa-east-1.rds.amazonaws.com', 3306, 'test', 'testtest', <<47, 115, 120, 35, 62, 81, 92, 88, 39, 87, 96, 94, 57, 62, 105, 121, 70, 46, 84, 62, 0>>, true, :infinity, :infinity, 60000, 0, 34, 0, 0, [], :undefined, {:dict, 0, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}}}, :empty, false}
03:53:51.226 [error] Connection Id 175396508 closing with reason: tcp_closed
03:53:51.228 [error] gen_server <0.2832.0> terminated with reason: tcp_closed
03:53:51.228 [error] CRASH REPORT Process <0.2832.0> with 0 neighbours exited with reason: tcp_closed in gen_server:handle_common_reply/8 line 751
03:53:51.228 [error] Supervisor {<0.2827.0>,poolboy_sup} had child mysql started with {mysql,start_link,undefined} at <0.2832.0> exit with reason tcp_closed in context child_terminated

11:53:47.422 [error] Connection Id 175989458 closing with reason: :tcp_closed

11:53:47.423 [error] GenServer #PID<0.14144.0> terminating
** (stop) :tcp_closed
Last message: {:tcp_closed, #Port<0.10733>}
State: {:state, [5, 5, 61], :undefined, :undefined, :gen_tcp, :undefined, 'test.sa-east-1.rds.amazonaws.com', 3306, 'test', 'testtest', <<92, 47, 115, 119, 124, 44, 94, 119, 91, 67, 125, 109, 42, 40, 42, 57, 33, 56, 55, 73, 0>>, true, :infinity, :infinity, 60000, 0, 2, 0, 0, [], :undefined, {:dict, 0, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}}}, :empty, false}
11:53:47.423 [error] Connection Id 175989458 closing with reason: tcp_closed
11:53:47.424 [error] gen_server <0.14144.0> terminated with reason: tcp_closed
11:53:47.425 [error] CRASH REPORT Process <0.14144.0> with 0 neighbours exited with reason: tcp_closed in gen_server:handle_common_reply/8 line 751
11:53:47.425 [error] Supervisor {<0.2827.0>,poolboy_sup} had child mysql started with {mysql,start_link,undefined} at <0.14144.0> exit with reason tcp_closed in context child_terminated

11:53:51.230 [error] Connection Id 175989747 closing with reason: :tcp_closed

11:53:51.231 [error] GenServer #PID<0.14146.0> terminating
** (stop) :tcp_closed
Last message: {:tcp_closed, #Port<0.10735>}
State: {:state, [5, 5, 61], :undefined, :undefined, :gen_tcp, :undefined, 'test.sa-east-1.rds.amazonaws.com', 3306, 'test', 'testtest', <<62, 36, 57, 50, 46, 47, 65, 56, 55, 72, 72, 108, 104, 72, 108, 104, 69, 93, 40, 77, 0>>, true, :infinity, :infinity, 60000, 0, 2, 0, 0, [], :undefined, {:dict, 0, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}}}, :empty, false}
11:53:51.231 [error] Connection Id 175989747 closing with reason: tcp_closed
11:53:51.232 [error] gen_server <0.14146.0> terminated with reason: tcp_closed
11:53:51.232 [error] CRASH REPORT Process <0.14146.0> with 0 neighbours exited with reason: tcp_closed in gen_server:handle_common_reply/8 line 751
11:53:51.233 [error] Supervisor {<0.2827.0>,poolboy_sup} had child mysql started with {mysql,start_link,undefined} at <0.14146.0> exit with reason tcp_closed in context child_terminated

from mysql-otp-poolboy.

zuiderkwast avatar zuiderkwast commented on August 18, 2024

It looks like the server closed the connection. Be default, MySQL closes the connection after 8 hours of inactivity. Check the wait_timeout server variable to find out. In the client, you can use the keep-alive option to send pings at regular intervals to prevent it.

from mysql-otp-poolboy.

retf avatar retf commented on August 18, 2024

Thk, In child_spec oj client?
mydb = :mysql_poolboy.child_spec(:pool_1,
[
{:size, 2}, {:max_overflow, 5}, { keep_alive, true}], [
{:host, :util.to_list(:maps.get("host", dbconf))},
{:user, :util.to_list(:maps.get("user", dbconf))},
{:password, :util.to_list(pw)}
])

This is correct?

from mysql-otp-poolboy.

getong avatar getong commented on August 18, 2024

{ :keep_alive, true}
If this works, please close this issue.

from mysql-otp-poolboy.

zuiderkwast avatar zuiderkwast commented on August 18, 2024

With MySQL/OTP 1.6.0, there is no error if the server closes the connection. It is a normal exit. Poolboy will restart the worker, which will reconnect.

Btw, I recommend using {connect_mode, lazy}, which makes sure the new process doesn't connect until any query is executed. It is no problem letting the server disconnect when a connection is inactive, so keep_alive is not needed. In this way, you don't have more connections to the server than what is needed.

from mysql-otp-poolboy.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.