Defect #25829

mysql2 0.3 gem doesn't properly close connections

Added by Pavel Rosický 5 months ago. Updated 5 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Gems support
Target version:3.2.7
Resolution:Fixed Affected version:2.0.0

Description

Hi,
I found that mysql2 (0.3.21) doesn't properly closing connections.

Our mysql's error logs are full of these warnings

11797 [Warning] Aborted connection 12561 to db: 'test' user: 'test' host: '127.0.0.1' (Got an error reading communication packets)
11798 [Warning] Aborted connection 12561 to db: 'test' user: 'test' host: '127.0.0.1' (Got an error reading communication packets)
11799 [Warning] Aborted connection 12561 to db: 'test' user: 'test' host: '127.0.0.1' (Got an error reading communication packets)
...

it is already fixed, but the change wasn't backported to the 0.3.x branch
https://github.com/brianmario/mysql2/issues/606

I can confirm the issue is gone after upgrading to the current version 0.4.6.

This version is still compatible with Ruby 1.9+ and it passes redmine tests. I also run our specs and it looks like everything is ok.

Notable changes:

* mysql 8 support
* prepared statements support
* connection.close/shutdown fix
* many bugfixes

Full changelog:
https://github.com/brianmario/mysql2/releases

Gemfile.patch Magnifier (508 Bytes) Pavel Rosický, 2017-05-12 23:57

Associated revisions

Revision 16553
Added by Jean-Philippe Lang 5 months ago

Use mysql2 0.4.6 instead of 0.3 (#25829).

Patch by Pavel Rosický.

History

#1 Updated by Go MAEDA 5 months ago

  • Tracker changed from Feature to Defect
  • Subject changed from upgrade mysql2 to mysql2 gem doesn't properly close connections
  • Target version set to 3.2.7
  • Affected version set to 2.0.0

Setting target version to 3.2.7.
I have been observing a significant increase in the number of connections on my environment for years, maybe caused by this issue.

Thank you for detecting and inspecting this issue.

#2 Updated by Jean-Philippe Lang 5 months ago

  • Subject changed from mysql2 gem doesn't properly close connections to mysql2 0.3 gem doesn't properly close connections
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Patch committed, thanks.

#3 Updated by Jean-Philippe Lang 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF