Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too many connections using pool #278

Open
guypaskar opened this issue Mar 27, 2016 · 10 comments
Open

too many connections using pool #278

guypaskar opened this issue Mar 27, 2016 · 10 comments

Comments

@guypaskar
Copy link

Hi there,

I'm using pool connections of 100 connections.
Once in awhile I'm getting the following error:

doSql pool.getConnection failed with error:Error: Host 'xxxxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

Any idea on how to fix this?

Best,
Guy

@sidorares
Copy link
Owner

hi @guypaskar , could you try my suggestion from #270 ?

@guypaskar
Copy link
Author

I'm not sure I understand what the issue there and what was the suggestion. Let me add a code snippet of how I use.

pool.getConnection(function(err, connection) {
            // Use the connection
            if(err){
                console.log('doSql pool.getConnection failed with error:' +err);
            }else{
                if(connection && 'query' in connection){
                    connection.query(stmt, function(err, rows) {
                        // And done with the connection.
                        if (err != null) {
                            console.log(err);
                        }
                        connection.release();
                        // The connection is terminated now
                        callback(rows, err);


                        // Don't use the connection here, it has been returned to the pool.
                    });
                }
            }


        }); 

@sidorares
Copy link
Owner

hm, #270 is about Pool.query() shortcut, looks like your issue is different as you are using getConnection() + connection.queue()

@sidorares
Copy link
Owner

@guypaskar looks like this it not directly related to pool, see for example http://stackoverflow.com/questions/2395654/mysql-phpmyadmin-many-connection-errors

Do you see this error for all connections or you are able to connect initially?

@guypaskar
Copy link
Author

Yeah I know this issue.
I thought it might be related to the pool. I'm not sure that is the case yet.
Maybe the pool it creating the "interrupted connect requests" somehow.

@sidorares
Copy link
Owner

can you post debug log here ( create pool with debug option set to true ) ?

@guypaskar
Copy link
Author

Sure. But I have to wait until the issue happens again no and only then send the log. No?

@sidorares
Copy link
Owner

yes, I need to see log around connection time.

@guypaskar
Copy link
Author

Ok. I will try to catch it and report back.

@Kennytian
Copy link

SET GLOBAL wait_timeout = 60;

run this command in mysql client command terminal, the timeout unit is seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants