[unixODBC-support] ini_cache_head not locked

Antony.Davies at tmx.com Antony.Davies at tmx.com
Tue Jul 5 15:11:26 BST 2011


Hi, (mistakently sent to dev mailing list) I was noticing problems witha 
multithreaded test program that that basically does this
    - connects
    - issues some sql
    - repeats

and obcinst.ini has Threading = 0 (using 2.2.12 unix odbc with an oracle 
driver on rh 5.5)

What I have seen is a double free occuring inside check_ini_cache() due to 
2 threads insided
SQLGetPrivateProfileString at the same time.

Should access to the this linked list be protected by a mutex ? Or is 
there some locking failure
at the unixodbc libarary level that allows two threads access to this 
linked list at the same time ?
Or is using Threads = 0 simply inherently dangerous? (I was under the 
impression that this
only controlled how the oracle driver was called by unixodbc)

Thanks for any help,
Antony

1st thread
#1  0x00000039bfe10ced in dl_open_worker () from 
/lib64/ld-linux-x86-64.so.2
#2  0x00000039bfe0ced6 in _dl_catch_error () from 
/lib64/ld-linux-x86-64.so.2
#3  0x00000039bfe1068c in _dl_open () from /lib64/ld-linux-x86-64.so.2
#4  0x00000039c0308ba0 in do_dlopen () from /lib64/libc.so.6
#5  0x00000039bfe0ced6 in _dl_catch_error () from 
/lib64/ld-linux-x86-64.so.2
#6  0x00000039c0308d07 in __libc_dlopen_mode () from /lib64/libc.so.6
#7  0x00000039c02e5eea in init () from /lib64/libc.so.6
#8  0x00002b676dbec083 in pthread_once () from /lib64/libpthread.so.0
#9  0x00000039c02e5f87 in backtrace () from /lib64/libc.so.6
#10 0x00000039c026a85f in __libc_message () from /lib64/libc.so.6
#11 0x00000039c027230f in _int_free () from /lib64/libc.so.6
#12 0x00000039c027276b in free () from /lib64/libc.so.6
#13 0x00002b676d9aef17 in check_ini_cache (ret=0x4ee3c7b8,
    pszSection=0x4ee3ef80 "<deleted fro privacy>", pszEntry=0x2b676d9b8b7e 
"DMEnvAttr",
    pszDefault=0x2b676d9b8a1e "", pRetBuffer=0x4ee3dc20 "", 
nRetBuffer=1024,
    pszFileName=0x2b676d9b8b75 "ODBC.INI") at 
SQLGetPrivateProfileString.c:77
#14 0x00002b676d9af32a in SQLGetPrivateProfileString (
    pszSection=0x4ee3ef80 "lflab_ETCASH", pszEntry=0x2b676d9b8b7e 
"DMEnvAttr",
    pszDefault=0x2b676d9b8a1e "", pRetBuffer=0x4ee3dc20 "", 
nRetBuffer=1024,
    pszFileName=0x2b676d9b8b75 "ODBC.INI") at 
SQLGetPrivateProfileString.c:228
#15 0x00002b676d95d269 in __handle_attr_extensions 
(connection=0x2aaab5573b40,
    dsn=0x4ee3ef80 "lflab_ETCASH", driver_name=0x4ee3e7a0 
"Oracle_ODBC_Driver")
    at SQLConnect.c:3479
#16 0x00002b676d95dccb in SQLConnect (connection_handle=0x2aaab5573b40,
    server_name=0x2aaab5484508 "lflab_ETCASH", name_length1=-3,
    user_name=0x2aaab5530338 "<deleted for privacy>", name_length2=-3,
    authentication=0x2aaab5498418 "<deleted for privacy>", 
name_length3=-3)
    at SQLConnect.c:3813
#17 0x00000000004016fc in DBInterface::Conn (this=0x2aaab55e8a00, dsn=...,
    uid=..., pswd=...) at odbc_2.2.12_failure2.cpp:71
#18 0x0000000000401c93 in thr_func (arg=0x0) at 
odbc_2.2.12_failure2.cpp:202
#19 0x00002b676dbe673d in start_thread () from /lib64/libpthread.so.0
#20 0x00000039c02d3d1d in clone () from /lib64/libc.so.6

#0  0x00000039c02c592b in open () from /lib64/libc.so.6
#1  0x00000039c026c2f3 in __GI__IO_file_open () from /lib64/libc.so.6
#2  0x00000039c026c43c in _IO_new_file_fopen () from /lib64/libc.so.6
#3  0x00000039c0261764 in __fopen_internal () from /lib64/libc.so.6
#4  0x00002b676d9a9d3a in iniOpen (hIni=0x44e2c178,
    pszFileName=0x44e2b1b0 "/tse_home/adavies//odbcinst.ini",
    cComment=0x2b676d9c5304 "#;", cLeftBracket=91 '[', cRightBracket=93 
']',
    cEqual=61 '=', bCreate=1) at iniOpen.c:394
#5  0x00002b676d9b384c in _SQLGetInstalledDrivers (
    pszSection=0x44e2e7a0 "Oracle_ODBC_Driver",
    pszEntry=0x2b676d9b8a11 "CPTimeToLive", pszDefault=0x2b676d9b89e5 "0",
    pRetBuffer=0x44e2df30 "", nRetBuffer=50) at 
_SQLGetInstalledDrivers.c:54
#6  0x00002b676d9af458 in SQLGetPrivateProfileString (
    pszSection=0x44e2e7a0 "Oracle_ODBC_Driver",
    pszEntry=0x2b676d9b8a11 "CPTimeToLive", pszDefault=0x2b676d9b89e5 "0",
    pRetBuffer=0x44e2df30 "", nRetBuffer=50,
    pszFileName=0x2b676d9b89bb "ODBCINST.INI")
    at SQLGetPrivateProfileString.c:254
#7  0x00002b676d95835d in __connect_part_one (connection=0x2aaab1b04d50,
    driver_lib=0x44e2eb90 "/tse_home/adavies/old_home/libsqora.so.10.1",
    driver_name=0x44e2e7a0 "Oracle_ODBC_Driver", warnings=0x44e2e4cc)
    at SQLConnect.c:953
#8  0x00002b676d95dce9 in SQLConnect (connection_handle=0x2aaab1b04d50,
    server_name=0x2aaab54d7a18 "lflab_ETCASH", name_length1=-3,
    user_name=0x2aaab54da808 "<deleted for privacy>", name_length2=-3,
    authentication=0x2aaab55c14d8 "<deleted for privacy>", 
name_length3=-3)
    at SQLConnect.c:3819
#9  0x00000000004016fc in DBInterface::Conn (this=0x2aaab532ecf0, dsn=...,
    uid=..., pswd=...) at odbc_2.2.12_failure2.cpp:71
#10 0x0000000000401c93 in thr_func (arg=0x0) at 
odbc_2.2.12_failure2.cpp:202
#11 0x00002b676dbe673d in start_thread () from /lib64/libpthread.so.0
#12 0x00000039c02d3d1d in clone () from /lib64/libc.so.6


Antony Davies
Sr. Application Developer
Info & Trading Technology
TSX Technologies
Phone: 416-947-4762
Email: Antony.Davies at tsx.com

--------------------------------------
NOTICE OF CONFIDENTIALITY
This e-mail, including all materials contained in or attached to this e-mail, contains proprietary and confidential information solely for the internal use of the intended recipient.  If you have received this email in error, please notify us immediately by return e-mail or otherwise and ensure that it is permanently deleted from your systems, and do not print, copy, distribute or read its contents.

AVIS DE CONFIDENTIALITÉ
Le présent courriel, y compris tous les documents qu'il contient ou qui y sont joints, renferme des renseignements exclusifs et confidentiels destinés uniquement à l'usage interne du destinataire prévu. Si vous avez reçu le présent courriel par erreur, veuillez nous aviser immédiatement, notamment par retour de courriel, et vous assurer qu'il est supprimé de façon permanente de vos systèmes; veuillez également vous abstenir d'imprimer, de copier, de distribuer ou de lire son contenu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20110705/2e261bfe/attachment.html>


More information about the unixODBC-support mailing list