Skip to content

Error: Connection lost: The server closed the connection. #1022

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

Closed
chacent opened this issue Mar 6, 2015 · 1 comment
Closed

Error: Connection lost: The server closed the connection. #1022

chacent opened this issue Mar 6, 2015 · 1 comment
Assignees
Labels

Comments

@chacent
Copy link

chacent commented Mar 6, 2015

i want to sync some data from mysql to sqlserver,and sql server may busy,it will take some time and i pause mysql connection,when time span take about 60s and then resume the mysql connection, an error occur, Error: Connection lost: The server closed the connection.,mysql server close the connection,how can i resolve the problem?
i can't reconnect mysql,because i want to deal the recordset continue;

@dougwilson
Copy link
Member

The problem is that your server is currently configured to close the connection quickly. You can do two things to help solve this:

  1. Don't call .pause() and instead buffer up all the results yourself. This will ensure the results flow from the server instead of keeping the connection idle. The downside is you'll need to fit all the results in memory on your Node.js process.
  2. Adjust the timeout on your MySQL server settings. You'll want to tweak the wait_timeout setting.

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

No branches or pull requests

2 participants