开发者

Randomly Cant connect to local MySQL?

This might be related to another problem i am having. But in this case my app was idling and i had a crash in my GetConnection() on conn.open().

Since i was idling i figure it had comething to do with my queue in the background and possibly garbage collection? I took a look at netstat and found 16 connections.

Does mysql only accept 16 connections by default? is it because i am opening too many connections? this IS because of not closing/disposing connections? might commands have something to do with it or is that completely not the problem and is a MySqlConnection issue?

  TCP    127.0.0.1:7919          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7920          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7921          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7922          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7开发者_StackOverflow中文版923          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7924          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:7926          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8782          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8783          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8784          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8785          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8786          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8787          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8788          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8791          Adam-PC:3306          ESTABLISHED
  TCP    127.0.0.1:8792          Adam-PC:3306          ESTABLISHED


Are you disposing your connections? MySQL itself has connection pooling and the way to return connections to the pool is by disposing them.

Garbage collection should not pose a problem if you are correctly disposing your connections after you've used them.


I've encountered this when using the MySQL connector. The work around I use is to manually turn off connection pooling in the connection string by adding "pooling=false;" to the end of the connection string. It will hurt your scalability but allow your application to run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜