Comments (6)
no match of right hand value
{error,closed}
inmysql_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.
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.
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.
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.
{ :keep_alive, true}
If this works, please close this issue.
from mysql-otp-poolboy.
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)
- Look into the changes of poolboy 1.5.X HOT 3
- last_insert_id ? HOT 2
- Bump deps MySQL/OTP 1.1.1 HOT 1
- Not prepared error HOT 1
- Restarting the mysql server is not detected by the driver. HOT 24
- Closed connection is not detected HOT 1
- rebar.config and Makefile mysql-otp mismatch HOT 2
- Function name "checkout_connection" is too long HOT 1
- could you update rebar.config to point to the latest mysql-otp ? HOT 6
- Add this to Hex? HOT 1
- with/2 for checkout-Fun()-checkin without SQL transaction HOT 1
- Use lazy connect and let server disconnect on inactivity HOT 4
- execute/3,4 for prepared statements HOT 2
- Rename add_pool OR change what it does HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-otp-poolboy.