[CONC-131] Memory leak in mysql_close() with MYSQL_OPT_NONBLOCK Created: 2015-06-14 Updated: 2015-07-30 Resolved: 2015-06-26 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | None |
| Affects Version/s: | 2.1 |
| Fix Version/s: | 3.0.0, 2.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | René Cannaò | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When a mysql connection is created and is set to not blocking, mysql_close() doesn't free the memory associate with async causing a severe memory leak. Depending from the the speed of your CPU and your available memory, the follow code can eat all available memory in just few seconds:
|
| Comments |
| Comment by René Cannaò [ 2015-06-14 ] | |||||||||||||||||
|
Quick patch in mysql_close_options() :
| |||||||||||||||||
| Comment by René Cannaò [ 2015-07-30 ] | |||||||||||||||||
|
Because non blocking API is implemented using coroutine, it is possible that the stack is freed while being used by another function. This will lead to invalid read/write on memory already freed.
|