[CONC-364] Not all sockets created in pvio_socket_connect function are closed Created: 2018-09-25 Updated: 2018-10-23 Resolved: 2018-10-23 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | None |
| Affects Version/s: | 3.0.6 |
| Fix Version/s: | 3.0.7, 3.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Pashkov | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
macOS 10.13.4 |
||
| Description |
|
The problem is reproducible if you try to connect to the inactive server on localhost(or 127.0.0.1). Open pvio_socket.c. The following call of getaddrinfo returns linked list of two items: IPv6 and IPv4 addresses
Then a new socket is created for each item in the list:
And attempt to connect:
But when the error handling is made, only the last created socket is closed:
While the previous (IPv6 in that case) remains not freed, which can be easily checked with lsof: $ lsof -p 95552 | grep CLOSED If multiple attempts are made the resource limit will be exceeded. |
| Comments |
| Comment by Gus Ito [ 2018-10-19 ] | ||||||||||||
|
In case it helps, here you are the fix I've applied on my build:
|