[unixODBC-support] file descriptor double close

Krzysztof Matczak krzysztof.matczak at tieto.com
Fri Aug 29 12:55:42 BST 2014


Hello everyone


Have you ever spotted  problem with double closing file descriptor when db
connection cannot be established ? I'm using unixodbc 2.3.2 with libmyodbc
5.3.2 ANSII driver. I've performed simple test:

1. shut down mysql server
2. simple  test application (open odbc connection on port 49897, create
table, do couple of SELECT queries, then SQLDisconnect ) run with  strace
shows following calls with doubled close(3) call:

64739 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
64739 connect(3, {sa_family=AF_INET, sin_port=htons(49897),
sin_addr=inet_addr("127.0.0.7")}, 16) = -1 ECONNREFUSED (Connection refused)
64739 close(3) = 0
64739 shutdown(3, 2 /* send and receive */) = -1 EBADF (Bad file descriptor)
64739 close(3) = -1 EBADF (Bad file descriptor)
64739 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
64739 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fb61e2a5000
64739 write(1, " Error: [unixODBC][MySQL][ODBC 5"..., 97) = 97
64739 exit_group(-1) = ?
.

Is this  known issue ?  According to my knowledge the second close is
potentially dangerous and this l is currently the main suspect for strange
random network connectivity problems in another much bigger app that uses
odbc  and some networking.

I've already discussed this issue with Oracle support (responsible for
myodbc driver ), but they blamed unixodbc.

Thanks in advance for support


BR

Krzysztof









BR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20140829/0090b9a2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbc.ini
Type: application/octet-stream
Size: 300 bytes
Desc: not available
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20140829/0090b9a2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbcinst.ini
Type: application/octet-stream
Size: 173 bytes
Desc: not available
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20140829/0090b9a2/attachment-0001.obj>


More information about the unixODBC-support mailing list