cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem connecting with ODBC

oneeyeman1
Participant
0 Likes
1,180

Hi, ALL,

I successfully installed SAP ASE 16.1 with the help from another recent thread.

 

Now I'm trying to run my software and connect with the native ODBC driver.

 

[code]

IgorReinCloud /home/igor # cat /etc/unixODBC/odbcinst.ini
[ODBC]
Trace=yes
TraceFile=/tmp/sql.log

[Sybase]
Description=Native Sybase Driver
Driver=/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so
#Driver=/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb-sqllen8.so
#Driver=/opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so
#Driver=/opt/sap/DataAccess/ODBC/lib/libsybdrvodb.so
FileUsage=1

[freeTDS]
Description=FreeTDS Driver
Driver=/usr/lib64/libtdsodbc.so
FileUsage=1

[Postgres]
Description=Postgres ODBC Driver
Driver=/usr/lib64/psqlodbcw.so
FileUsage=1

IgorReinCloud /home/igor # cat /etc/unixODBC/odbc.ini
[Sybase16]
Driver=Sybase
Description=Sybase 16 Native Driver
Trace=Yes
Server=localhost
Database=draft
TraceLog=/tmp/sql.log
Port=5000
UserID=sa

[sampledsn]
Driver=Sybase
Description=Sybase 16 Native Driver
Trace=Yes
Server=localhost
Database=pubs2
TraceLog=/tmp/sql.log
Port=5000
UserID=sa
Password=wasqra123

[freetds]
Driver=freeTDS
Description=FreeTDS driver
Trace=Yes
Server=localhost
Database=draft
Port=5000
TDS_Version=5.0

[freetds_MSSQL]
Driver=freeTDS
Description=FreeTDS MS SQL Connection
Trace=Yes
Server=192.168.1.91
Database=draft
Port=1433

[postgres]
Driver=Postgres
Description=Postgres ODBC Driver
UserId=postgres
Password=wasqra
Servername=192.168.1.209
Database=draft
Port=5432
IgorReinCloud /home/igor #

[/code]

 

And now I'm trying to connect with:

[code]

ret = SQLDriverConnect( m_hdbc, m_handle, connectStrIn, SQL_NTS, m_connectString, 1024, &OutConnStrLen, options );

[/code]

and I got the following results:

 

[code]

==12489==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x6040002ad150
#0 0x7ffff767b2a7 in operator delete(void*, unsigned long) /var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/libsanitizer/asan/asan_new_delete.cpp:172
#1 0x7fffe6f5cb9e in SybaseTds::NegotiateContext::ProcessPwdEnc(int) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xc8b9e)
#2 0x7fffe6f5d309 in SybaseTds::NegotiateContext::MSG() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xc9309)
#3 0x7fffe6f5c454 in SybaseTds::NegotiateContext::Negotiate() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xc8454)
#4 0x7fffe6f4fcde in SybaseTds::LoginContext::LOGINACK() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xbbcde)
#5 0x7fffe6f50273 in SybaseTds::LoginContext::ProcessLoginAck() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xbc273)
#6 0x7fffe6fa3085 in SybaseTds::TdsConnection::DoTryConnect(SybaseTds::MTString const&, SybaseTds::MTString const&, bool) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x10f085)
#7 0x7fffe6fac7bd in SybaseTds::TdsConnection::TryConnect(SybaseTds::MTString const&, SybaseTds::MTString const&, bool) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x1187bd)
#8 0x7fffe6f4c893 in SybaseTds::HAContext::HandleFailOver() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xb8893)
#9 0x7fffe6fab92b in SybaseTds::TdsConnection::Connect(SybaseTds::SynchronizedSybProperty*, BatchTimers*, SelectTimers*) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x11792b)
#10 0x7fffe7008aab in SybaseOdbc::OdbcConnection::TryToConnectAndCreateConnectionString(bool, bool, void*, SybaseTds::MTString&, unsigned char*, short*, short) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x174aab)
#11 0x7fffe700d754 in SybaseOdbc::OdbcConnection::DriverConnect(void*, unsigned char*, short, unsigned char*, short*, short, unsigned short) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x179754)
#12 0x7fffe700e1e5 in SybaseOdbc::OdbcConnection::DriverConnectW(void*, unsigned short*, short, unsigned short*, short*, short, unsigned short) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x17a1e5)
#13 0x7fffe8fd1ef3 in SQLDriverConnectW (/usr/lib64/libodbc.so.2+0x2eef3)
#14 0x7fffe946fc70 in ODBCDatabase::Connect(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >&, std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >&) ../../libodbc/database_odbc.cpp:746
#15 0x7fffe987ffc1 in ConnectToDb ../../libdbloader/dbloader.cpp:202
#16 0x555555585b78 in MainFrame::Connect(bool) ../../dbhandler/mainframe.cpp:504
#17 0x555555588074 in MainFrame::OnDatabaseProfile(wxCommandEvent&) ../../dbhandler/mainframe.cpp:733
#18 0x7ffff5f79f36 in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ../src/common/appbase.cpp:681
#19 0x7ffff5f79fa9 in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ../src/common/appbase.cpp:693
#20 0x7ffff60f4c39 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ../src/common/event.cpp:1468
#21 0x7ffff60f39de in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ../src/common/event.cpp:1074
#22 0x7ffff60f5156 in wxEvtHandler::TryHereOnly(wxEvent&) ../src/common/event.cpp:1655
#23 0x7ffff60f6db8 in wxEvtHandler::TryBeforeAndHere(wxEvent&) ../include/wx/event.h:4078
#24 0x7ffff60f4f52 in wxEvtHandler::ProcessEventLocally(wxEvent&) ../src/common/event.cpp:1588
#25 0x7ffff60f4ee9 in wxEvtHandler::ProcessEvent(wxEvent&) ../src/common/event.cpp:1561
#26 0x7ffff6907857 in wxWindowBase::TryAfter(wxEvent&) ../src/common/wincmn.cpp:3516
#27 0x7ffff60f4f1c in wxEvtHandler::ProcessEvent(wxEvent&) ../src/common/event.cpp:1574
#28 0x7ffff60f5208 in operator() ../src/common/event.cpp:1675
#29 0x7ffff60f6163 in wxSafeCall<bool, wxEvtHandler::SafelyProcessEvent(wxEvent&)::<lambda()>, wxEvtHandler::SafelyProcessEvent(wxEvent&)::<lambda()> > ../include/wx/private/safecall.h:40
#30 0x7ffff60f5265 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ../src/common/event.cpp:1673
#31 0x7ffff69015ed in wxWindowBase::HandleWindowEvent(wxEvent&) const ../src/common/wincmn.cpp:1517
#32 0x7ffff68e5026 in wxToolBarBase::OnLeftClick(int, bool) ../src/common/tbarbase.cpp:714
#33 0x7ffff6762d11 in item_clicked ../src/gtk/toolbar.cpp:83
#34 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#35 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#36 0x7ffff4b12f15 in g_signal_emit_by_name (/usr/lib64/libgobject-2.0.so.0+0x2ff15)
#37 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#38 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#39 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#40 0x7ffff529ed4f (/usr/lib64/libgtk-3.so.0+0x13fd4f)
#41 0x7ffff4af999f in g_closure_invoke (/usr/lib64/libgobject-2.0.so.0+0x1699f)
#42 0x7ffff4b0bf04 (/usr/lib64/libgobject-2.0.so.0+0x28f04)
#43 0x7ffff4b1275e in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2f75e)
#44 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#45 0x7ffff529cf5f (/usr/lib64/libgtk-3.so.0+0x13df5f)
#46 0x7ffff556bbff (/usr/lib64/libgtk-3.so.0+0x40cbff)
#47 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#48 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#49 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#50 0x7ffff536ffc3 (/usr/lib64/libgtk-3.so.0+0x210fc3)
#51 0x7ffff4afcc61 in g_cclosure_marshal_VOID__BOXEDv (/usr/lib64/libgobject-2.0.so.0+0x19c61)
#52 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#53 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#54 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#55 0x7ffff536ced6 (/usr/lib64/libgtk-3.so.0+0x20ded6)
#56 0x7ffff536e612 (/usr/lib64/libgtk-3.so.0+0x20f612)
#57 0x7ffff53718ba (/usr/lib64/libgtk-3.so.0+0x2128ba)
#58 0x7ffff53365eb in gtk_event_controller_handle_event (/usr/lib64/libgtk-3.so.0+0x1d75eb)
#59 0x7ffff550ae3c (/usr/lib64/libgtk-3.so.0+0x3abe3c)
#60 0x7ffff5565645 (/usr/lib64/libgtk-3.so.0+0x406645)
#61 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#62 0x7ffff4b11e76 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2ee76)
#63 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#64 0x7ffff550c823 (/usr/lib64/libgtk-3.so.0+0x3ad823)
#65 0x7ffff53ba957 (/usr/lib64/libgtk-3.so.0+0x25b957)
#66 0x7ffff53bc4d2 in gtk_main_do_event (/usr/lib64/libgtk-3.so.0+0x25d4d2)
#67 0x7ffff5092304 (/usr/lib64/libgdk-3.so.0+0x3c304)
#68 0x7ffff50c7f01 (/usr/lib64/libgdk-3.so.0+0x71f01)
#69 0x7ffff49f99b1 in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x559b1)
#70 0x7ffff49f9ea4 (/usr/lib64/libglib-2.0.so.0+0x55ea4)
#71 0x7ffff49fa1d2 in g_main_loop_run (/usr/lib64/libglib-2.0.so.0+0x561d2)
#72 0x7ffff53bb66c in gtk_main (/usr/lib64/libgtk-3.so.0+0x25c66c)
#73 0x7ffff6686646 in wxGUIEventLoop::DoRun() ../src/gtk/evtloop.cpp:68
#74 0x7ffff5fc9daf in wxEventLoopBase::Run() ../src/common/evtloopcmn.cpp:88
#75 0x7ffff5f793b5 in wxAppConsoleBase::MainLoop() ../src/common/appbase.cpp:393
#76 0x7ffff5f79096 in wxAppConsoleBase::OnRun() ../src/common/appbase.cpp:291
#77 0x7ffff67a9104 in wxAppBase::OnRun() ../src/common/appcmn.cpp:350
#78 0x7ffff600ee01 in operator() ../src/common/init.cpp:563
#79 0x7ffff600f13b in wxSafeCall<int, wxEntry(int&, wxChar**)::<lambda()>, wxEntry(int&, wxChar**)::<lambda()> > ../include/wx/private/safecall.h:40
#80 0x7ffff600ef7d in wxEntry(int&, wchar_t**) ../src/common/init.cpp:550
#81 0x7ffff600f00c in wxEntry(int&, char**) ../src/common/init.cpp:577
#82 0x5555555756d3 in main ../../dbhandler/docview.cpp:70
#83 0x7ffff59ee2f9 (/lib64/libc.so.6+0x292f9)
#84 0x7ffff59ee3bb in __libc_start_main (/lib64/libc.so.6+0x293bb)
#85 0x555555572f00 in _start (/home/igor/dbhandler/Debug/dbhandler/dbhandler+0x1ef00)

0x6040002ad150 is located 0 bytes inside of 41-byte region [0x6040002ad150,0x6040002ad179)
allocated by thread T0 here:
#0 0x7ffff767a3e7 in operator new[](unsigned long) /var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/libsanitizer/asan/asan_new_delete.cpp:102
#1 0x7fffe6f5cad0 in SybaseTds::NegotiateContext::ProcessPwdEnc(int) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xc8ad0)
#2 0x7fffe6f5d309 in SybaseTds::NegotiateContext::MSG() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0xc9309)

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch /var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/libsanitizer/asan/asan_new_delete.cpp:172 in operator delete(void*, unsigned long)
==12489==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==12489==ABORTING
[Thread 0x7fffebfb6640 (LWP 12590) exited]
[Thread 0x7fffec7b7640 (LWP 12589) exited]
[Inferior 1 (process 12489) exited with code 01]
(gdb)

[/code]

 

I can successfully connect using "dbisql" - I did and successfully created the "draft" database.

 

How can I fix the ODBC connection?

BTW - I presume the driver is 64 bit. Is there a version for 32 bit available somewhere? Because its possible there is a bitness mismatch....

 

Thank you.

 

 

View Entire Topic
ryan_hansen
Product and Topic Expert
Product and Topic Expert

Hi,

Test with unixODBC isql:
$ cat odbc.ini
[sampledsn]
Description = Sybase ODBC Data Source
UserID = sa
Password = Sybase123
Driver = /work/hansenr/ase16102/DataAccess64/ODBC/lib/libsybdrvodb.so <--- 16.1 SP00 PL02
Server = myhost
Port = 5000
$ echo $ODBCINI
/work/hansenr/ase16102/DataAccess64/ODBC/odbc.ini
$ /usr/bin/isql sampledsn
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>


Test with Samples:
$ setenv DRIVER_LIBRARY_PATH /work/hansenr/ase16102/DataAccess64/ODBC/lib
$ pwd
/work/hansenr/ase16102/DataAccess64/ODBC/samples
$ ./build simple compile
Using compiler g++. Make sure that it is reachable from your PATH
g++ -m64 -I/work/hansenr/ase16102/DataAccess64/ODBC/include -fshort-wchar -c *.cpp
g++ -o simple -m64 -lodbc *.o

$ ./build simple run
*** Running the sample ***
Using connection string "DSN=sampledsn"
SQLExecDirect failed
SQLRETURN code is -1
SqlState : 42000 Error Message :[SAP][ASE ODBC Driver][Adaptive Server Enterprise]authors not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

Error is fine as it connected and my server doesn't have pubs2 or that specific sample table.
The driver works correctly in that sense.


Found the KBA and this issue before
Repro:
$ cd $SYBASE/DataAccess64/ODBC
$ cat odbc.ini
[sampledsn]
UserId = username
Password = password
Driver = Adaptive Server Enterprise
Server = myasehost
Port = 5000
EncryptPassword = 1

$ cat odbcinst.ini
[Adaptive Server Enterprise]
Driver = /work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so <--- ASE 16.0 SP04 PL04
FileUsage = -1
UsageCount = 7

$ cd samples/simple
$ gcc -I$SYBASE/DataAccess64/ODBC/include -I$SYBASE/DataAccess64/ODBC/dm/include -lodbc -lstdc++ -fsanitize=address -O1 -fno-omit-frame-pointer -L$SYBASE/DataAccess64/ODBC/lib simple.cpp
$ ls
a.out build makefile readme.txt simple.cpp simple.h
$ ./a.out
Using connection string "DSN=sampledsn"
=================================================================
==3018897==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x60400002d010
#0 0x7f476ad83698 in operator delete(void*) (/lib64/libasan.so.5+0xf2698)
#1 0x7f4765d7c90b in SybaseTds::NegotiateContext::ProcessPwdEnc(int) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xf690b)
#2 0x7f4765d7d19a in SybaseTds::NegotiateContext::MSG() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xf719a)
#3 0x7f4765de175c in SybaseTds::Tokenizer::ProcessNextToken(SybaseTds::TdsBaseDataInputStream*, SybaseTds::TokenHandler*, SybaseTds::TdsBaseContext*, unsigned char*) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x15b75c)
#4 0x7f4765d7c2ce in SybaseTds::NegotiateContext::Negotiate() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xf62ce)
#5 0x7f4765d7082e in SybaseTds::LoginContext::LOGINACK() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xea82e)
#6 0x7f4765de167c in SybaseTds::Tokenizer::ProcessNextToken(SybaseTds::TdsBaseDataInputStream*, SybaseTds::TokenHandler*, SybaseTds::TdsBaseContext*, unsigned char*) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x15b67c)
#7 0x7f4765d70ac6 in SybaseTds::LoginContext::ProcessLoginAck() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xeaac6)
#8 0x7f4765dc1566 in SybaseTds::TdsConnection::ProcessLoginAck() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x13b566)
#9 0x7f4765dc0c96 in SybaseTds::TdsConnection::DoTryConnect(SybaseTds::MTString const&, SybaseTds::MTString const&, bool) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x13ac96)
#10 0x7f4765dc064d in SybaseTds::TdsConnection::TryConnect(SybaseTds::MTString const&, SybaseTds::MTString const&, bool) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x13a64d)
#11 0x7f4765d6baeb in SybaseTds::HAContext::HandleFailOver() (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xe5aeb)
#12 0x7f4765dc960b in SybaseTds::TdsConnection::Connect(SybaseTds::SynchronizedSybProperty*, BatchTimers*, SelectTimers*) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x14360b)
#13 0x7f4765e3ec06 in SybaseOdbc::OdbcConnection::TryToConnectAndCreateConnectionString(bool, bool, void*, SybaseTds::MTString&, unsigned char*, short*, short) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x1b8c06)
#14 0x7f4765e4285c in SybaseOdbc::OdbcConnection::DriverConnect(void*, unsigned char*, short, unsigned char*, short*, short, unsigned short) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x1bc85c)
#15 0x7f4765e6b4c7 in SQLDriverConnect (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0x1e54c7)
#16 0x7f476aa347c4 in SQLDriverConnect (/lib64/libodbc.so.2+0x147c4)
#17 0x4023a7 in main (/work/hansenr/ase1644/DataAccess64/ODBC/samples/simple/a.out+0x4023a7)
#18 0x7f476a0e8d84 in __libc_start_main (/lib64/libc.so.6+0x3ad84)
#19 0x40179d in _start (/work/hansenr/ase1644/DataAccess64/ODBC/samples/simple/a.out+0x40179d)

0x60400002d010 is located 0 bytes inside of 38-byte region [0x60400002d010,0x60400002d036)
allocated by thread T0 here:
#0 0x7f476ad829a0 in operator new[](unsigned long) (/lib64/libasan.so.5+0xf19a0)
#1 0x7f4765d7c78c in SybaseTds::NegotiateContext::ProcessPwdEnc(int) (/work/hansenr/ase1644/DataAccess64/ODBC/lib/libsybdrvodb.so+0xf678c)
#2 0x6130000001ff (<unknown module>)

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/lib64/libasan.so.5+0xf2698) in operator delete(void*)
==3018897==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==3018897==ABORTING


Findings:
I've only seen this message onces before using ASAN and found the KBA.
This was brought up with https://me.sap.com/notes/0003413266

This needs to be updated and I can do that.
This isn't an issue but a miss hit by ASAN.
Engineering checked the code and there isn't an issue with memory allocation.


Hope that helps,
Ryan

oneeyeman1
Participant
0 Likes

@ryan_hansen,

thx for the reply.

 

so what do I do? How do I work around that?

 

ASAN is such a helpful tool…

 

Thank you.

 

ryan_hansen
Product and Topic Expert
Product and Topic Expert
0 Likes
Compile and see if that is the only "error". You can then compile with ASAN_OPTIONS=alloc_dealloc_mismatch=0. Other option is to turn password encryption off from the ODBC driver side to validate and test if the ASE isn't setup with forced password encryption ("sp_configure 'net password'" value back is 0). ODBC connection string/DSN EncryptPassword=0
oneeyeman1
Participant
0 Likes

@ryan_hansen,

I used the ASAN_OPTION and it worked.

 

However it looks like ASAN in general is not compatible with ASE ODBC. 😉

 

Following code:

 

[code]

int result = 0;
std::wstring query;
unsigned long versionMajor = 0, versionMinor = 0;
SQLLEN cbVersion = SQL_NTS;
SQLWCHAR version[1024];
query = L"SELECT @@version_number AS version, @@version_as_integer / 1000000 AS major, ( @@version_as_integer / 1000 - ((@@version_as_integer / 1000000)*1000) ) / 100 AS minor;";
SQLRETURN retcode = SQLAllocHandle( SQL_HANDLE_STMT, m_hdbc, &m_hstmt );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, CONN_ERROR );
result = 1;
}
else
{
std::unique_ptr<SQLWCHAR[]> qry( new SQLWCHAR[query.length() + 2] );
memset( qry.get(), '\0', query.length() + 2 );
uc_to_str_cpy( qry.get(), query );
retcode = SQLExecDirect( m_hstmt, qry.get(), SQL_NTS );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
else
{
retcode = SQLBindCol( m_hstmt, 1, SQL_C_WCHAR, &version, 1024, &cbVersion );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
else
{
retcode = SQLBindCol( m_hstmt, 2, SQL_C_SLONG, &versionMajor, 0, 0 );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
else
{
retcode = SQLBindCol( m_hstmt, 3, SQL_C_SLONG, &versionMinor, 0, 0 );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
}
}
if( !result )
{
retcode = SQLFetch( m_hstmt );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
else
{
str_to_uc_cpy( pimpl.m_serverVersion, version );
pimpl.m_versionMajor = (int) versionMajor;
pimpl.m_versionMinor = (int) versionMinor;
}
}
}
}
}
if( result == 1 )
{
retcode = SQLEndTran( SQL_HANDLE_DBC, m_hdbc, SQL_ROLLBACK );
}
else
{
retcode = SQLEndTran( SQL_HANDLE_DBC, m_hdbc, SQL_COMMIT );
}
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, CONN_ERROR );
result = 1;
}
retcode = SQLFreeHandle( SQL_HANDLE_STMT, m_hstmt );
if( retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, STMT_ERROR );
result = 1;
}
m_hstmt = 0;
}

[/code]

results in:

 

[code]

=================================================================
==10352==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x603000587170 in thread T0:
object passed to delete has wrong type:
size of the allocated type: 24 bytes;
size of the deallocated type: 8 bytes.
#0 0x7ffff767b2a7 in operator delete(void*, unsigned long) /var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/libsanitizer/asan/asan_new_delete.cpp:172
#1 0x7fffe70225b9 in SybaseOdbc::OdbcStatement::~OdbcStatement() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x19e5b9)
#2 0x7fffe70227d8 in SybaseOdbc::OdbcStatement::~OdbcStatement() (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x19e7d8)
#3 0x7fffe6fdf339 in SybaseTds::MTList::RemoveFirst(bool) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x15b339)
#4 0x7fffe6ff47b4 in SybaseOdbc::OdbcConnection::RemoveStatementHandle(SybaseOdbc::OdbcStatement*) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x1707b4)
#5 0x7fffe701507f in SQLFreeHandleWork(short, void*) (/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so+0x19107f)
#6 0x7fffe8fbc36d (/usr/lib64/libodbc.so.2+0x1936d)
#7 0x7fffe94aaebd in ODBCDatabase::GetServerVersion(std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >&) ../../libodbc/database_odbc.cpp:6128
#8 0x7fffe94702a8 in ODBCDatabase::Connect(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >&, std::vector<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >&) ../../libodbc/database_odbc.cpp:820
#9 0x7fffe987ffc1 in ConnectToDb ../../libdbloader/dbloader.cpp:202
#10 0x555555585b78 in MainFrame::Connect(bool) ../../dbhandler/mainframe.cpp:504
#11 0x555555588074 in MainFrame::OnDatabaseProfile(wxCommandEvent&) ../../dbhandler/mainframe.cpp:733
#12 0x7ffff5f79f36 in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ../src/common/appbase.cpp:681
#13 0x7ffff5f79fa9 in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ../src/common/appbase.cpp:693
#14 0x7ffff60f4c39 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ../src/common/event.cpp:1468
#15 0x7ffff60f39de in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) ../src/common/event.cpp:1074
#16 0x7ffff60f5156 in wxEvtHandler::TryHereOnly(wxEvent&) ../src/common/event.cpp:1655
#17 0x7ffff60f6db8 in wxEvtHandler::TryBeforeAndHere(wxEvent&) ../include/wx/event.h:4078
#18 0x7ffff60f4f52 in wxEvtHandler::ProcessEventLocally(wxEvent&) ../src/common/event.cpp:1588
#19 0x7ffff60f4ee9 in wxEvtHandler::ProcessEvent(wxEvent&) ../src/common/event.cpp:1561
#20 0x7ffff6907857 in wxWindowBase::TryAfter(wxEvent&) ../src/common/wincmn.cpp:3516
#21 0x7ffff60f4f1c in wxEvtHandler::ProcessEvent(wxEvent&) ../src/common/event.cpp:1574
#22 0x7ffff60f5208 in operator() ../src/common/event.cpp:1675
#23 0x7ffff60f6163 in wxSafeCall<bool, wxEvtHandler::SafelyProcessEvent(wxEvent&)::<lambda()>, wxEvtHandler::SafelyProcessEvent(wxEvent&)::<lambda()> > ../include/wx/private/safecall.h:40
#24 0x7ffff60f5265 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ../src/common/event.cpp:1673
#25 0x7ffff69015ed in wxWindowBase::HandleWindowEvent(wxEvent&) const ../src/common/wincmn.cpp:1517
#26 0x7ffff68e5026 in wxToolBarBase::OnLeftClick(int, bool) ../src/common/tbarbase.cpp:714
#27 0x7ffff6762d11 in item_clicked ../src/gtk/toolbar.cpp:83
#28 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#29 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#30 0x7ffff4b12f15 in g_signal_emit_by_name (/usr/lib64/libgobject-2.0.so.0+0x2ff15)
#31 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#32 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#33 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#34 0x7ffff529ed4f (/usr/lib64/libgtk-3.so.0+0x13fd4f)
#35 0x7ffff4af999f in g_closure_invoke (/usr/lib64/libgobject-2.0.so.0+0x1699f)
#36 0x7ffff4b0bf04 (/usr/lib64/libgobject-2.0.so.0+0x28f04)
#37 0x7ffff4b1275e in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2f75e)
#38 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#39 0x7ffff529cf5f (/usr/lib64/libgtk-3.so.0+0x13df5f)
#40 0x7ffff556bbff (/usr/lib64/libgtk-3.so.0+0x40cbff)
#41 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#42 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#43 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#44 0x7ffff536ffc3 (/usr/lib64/libgtk-3.so.0+0x210fc3)
#45 0x7ffff4afcc61 in g_cclosure_marshal_VOID__BOXEDv (/usr/lib64/libgobject-2.0.so.0+0x19c61)
#46 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#47 0x7ffff4b12ad2 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2fad2)
#48 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#49 0x7ffff536ced6 (/usr/lib64/libgtk-3.so.0+0x20ded6)
#50 0x7ffff536e612 (/usr/lib64/libgtk-3.so.0+0x20f612)
#51 0x7ffff53718ba (/usr/lib64/libgtk-3.so.0+0x2128ba)
#52 0x7ffff53365eb in gtk_event_controller_handle_event (/usr/lib64/libgtk-3.so.0+0x1d75eb)
#53 0x7ffff550ae3c (/usr/lib64/libgtk-3.so.0+0x3abe3c)
#54 0x7ffff5565645 (/usr/lib64/libgtk-3.so.0+0x406645)
#55 0x7ffff4af9bc0 (/usr/lib64/libgobject-2.0.so.0+0x16bc0)
#56 0x7ffff4b11e76 in g_signal_emit_valist (/usr/lib64/libgobject-2.0.so.0+0x2ee76)
#57 0x7ffff4b12cce in g_signal_emit (/usr/lib64/libgobject-2.0.so.0+0x2fcce)
#58 0x7ffff550c823 (/usr/lib64/libgtk-3.so.0+0x3ad823)
#59 0x7ffff53ba957 (/usr/lib64/libgtk-3.so.0+0x25b957)
#60 0x7ffff53bc4d2 in gtk_main_do_event (/usr/lib64/libgtk-3.so.0+0x25d4d2)
#61 0x7ffff5092304 (/usr/lib64/libgdk-3.so.0+0x3c304)
#62 0x7ffff50c7f01 (/usr/lib64/libgdk-3.so.0+0x71f01)
#63 0x7ffff49f99b1 in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x559b1)
#64 0x7ffff49f9ea4 (/usr/lib64/libglib-2.0.so.0+0x55ea4)
#65 0x7ffff49fa1d2 in g_main_loop_run (/usr/lib64/libglib-2.0.so.0+0x561d2)
#66 0x7ffff53bb66c in gtk_main (/usr/lib64/libgtk-3.so.0+0x25c66c)
#67 0x7ffff6686646 in wxGUIEventLoop::DoRun() ../src/gtk/evtloop.cpp:68
#68 0x7ffff5fc9daf in wxEventLoopBase::Run() ../src/common/evtloopcmn.cpp:88
#69 0x7ffff5f793b5 in wxAppConsoleBase::MainLoop() ../src/common/appbase.cpp:393
#70 0x7ffff5f79096 in wxAppConsoleBase::OnRun() ../src/common/appbase.cpp:291
#71 0x7ffff67a9104 in wxAppBase::OnRun() ../src/common/appcmn.cpp:350
#72 0x7ffff600ee01 in operator() ../src/common/init.cpp:563
#73 0x7ffff600f13b in wxSafeCall<int, wxEntry(int&, wxChar**)::<lambda()>, wxEntry(int&, wxChar**)::<lambda()> > ../include/wx/private/safecall.h:40
#74 0x7ffff600ef7d in wxEntry(int&, wchar_t**) ../src/common/init.cpp:550
#75 0x7ffff600f00c in wxEntry(int&, char**) ../src/common/init.cpp:577
#76 0x5555555756d3 in main ../../dbhandler/docview.cpp:70
#77 0x7ffff59ee2f9 (/lib64/libc.so.6+0x292f9)
#78 0x7ffff59ee3bb in __libc_start_main (/lib64/libc.so.6+0x293bb)
#79 0x555555572f00 in _start (/usr/local/bin/dbhandler+0x1ef00)

[/code]

 

I will try to turn off this option as well...