Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error with tdbc::odbc bug?

65 views
Skip to first unread message

Manfred

unread,
Aug 12, 2019, 2:53:59 PM8/12/19
to
Hi

I have a small script:

##

package require tdbc::odbc

set con [tdbc::odbc::connection new "<connection string>"]

$con columns artikel

##


If I run the scirpt I get an error:

Speicherzugriffsfehler (Speicherabzug geschrieben)
memory access error (Dumping written)

System:
Kubuntu 19.04
Tcl/Tk 8.6.9 (self compiled)
Database "Firebird 3.0"

Manfred

unread,
Aug 13, 2019, 1:53:16 PM8/13/19
to
Hi

The error is in file tdbc.tcl on line 794 from the tdbc package.

line:794 while {[my $delegate row]} {
.....

The variable "delegate" has the value "nextdict".

The method "nextdict" is implemented in C. Is in package tdbc::odbc.

I have no experience in C, and I am not able to solve the problem.

Can anybody help me.

regards
Manfred


Am 12.08.19 um 20:53 schrieb Manfred:

stefan

unread,
Aug 13, 2019, 4:12:24 PM8/13/19
to
Hi Manfred,

> > If I run the scirpt I get an error:
> >
> > Speicherzugriffsfehler (Speicherabzug geschrieben)
> > memory access error (Dumping written)

Can you run your script using gdb?

1) Install gdb:

sudo apt-get install gdb

2) As you self-compiled Tcl (incl. tdbc::odbc), re-build it using the "--enable-symbols" flag to configure.

3) Then, start "tclsh" under gdb's watch:

$ gdb tclsh

(in GDB shell:)

(gdb) r /path/to/your/script.tcl

Once gdb catches the crash, type:

(gdb) bt

This will print a backtrace, pointing to the memory access violation in tdbc::odbc. Post the backtrace here.



Manfred

unread,
Aug 14, 2019, 3:33:52 AM8/14/19
to
Hi

Here my backtrace:

source testodbc.tcl
[New Thread 0x7ffff67b5700 (LWP 11010)]
[New Thread 0x7ffff5fb4700 (LWP 11011)]

Thread 1 "tclsh8.6" received signal SIGSEGV, Segmentation fault.
0x00007ffff6f449fe in
OdbcJdbcLibrary::OdbcConvert::convVarStringToString(OdbcJdbcLibrary::DescRecord*,
OdbcJdbcLibrary::DescRecord*) () from /usr/local/lib/libOdbcFb.so
(gdb) bt
#0 0x00007ffff6f449fe in
OdbcJdbcLibrary::OdbcConvert::convVarStringToString(OdbcJdbcLibrary::DescRecord*,
OdbcJdbcLibrary::DescRecord*) () from /usr/local/lib/libOdbcFb.so
#1 0x00007ffff6f5aac6 in
OdbcJdbcLibrary::OdbcStatement::sqlGetData(int, int, void*, int, int*)
() from /usr/local/lib/libOdbcFb.so
#2 0x00007ffff6f24bc7 in SQLGetData () from /usr/local/lib/libOdbcFb.so
#3 0x00007ffff71b43ce in SQLGetData () from
/usr/lib/x86_64-linux-gnu/libodbc.so
#4 0x00007ffff7d60999 in GetCell (rdata=0x5555556606b0,
interp=0x55555556a990, i=0, colObjPtr=0x7fffffffe0c0)
at
/home/manfred/Downloads/tcl8.6.9/pkgs/tdbcodbc1.1.0/generic/tdbcodbc.c:4413
#5 0x00007ffff7d60208 in ResultSetNextrowMethod (clientData=0x0,
interp=0x55555556a990, context=0x555555578c40, objc=3, objv=0x555555578c18)
at
/home/manfred/Downloads/tcl8.6.9/pkgs/tdbcodbc1.1.0/generic/tdbcodbc.c:4180
#6 0x00007ffff7f52794 in TclOOInvokeContext (clientData=0x555555578c40,
interp=0x55555556a990, objc=3, objv=0x555555578c18)
at /home/manfred/Downloads/tcl8.6.9/generic/tclOOCall.c:309
#7 0x00007ffff7f4ea90 in TclOOObjectCmdCore (oPtr=0x55555566f170,
interp=0x55555556a990, objc=3, objv=0x555555578c18, flags=0, startCls=0x0)
at /home/manfred/Downloads/tcl8.6.9/generic/tclOO.c:2577
#8 0x00007ffff7f4e45e in PrivateNRObjectCmd (clientData=0x55555566f170,
interp=0x55555556a990, objc=3, objv=0x555555578c18)
at /home/manfred/Downloads/tcl8.6.9/generic/tclOO.c:2414
#9 0x00007ffff7dbc1cd in Dispatch (data=0x55555562c3f8,
interp=0x55555556a990, result=0) at
/home/manfred/Downloads/tcl8.6.9/generic/tclBasic.c:4426
#10 0x00007ffff7dbc25a in TclNRRunCallbacks (interp=0x55555556a990,
result=0, rootPtr=0x0) at
/home/manfred/Downloads/tcl8.6.9/generic/tclBasic.c:4461
#11 0x00007ffff7dbefbc in TclEvalObjEx (interp=0x55555556a990,
objPtr=0x555555688360, flags=131072, invoker=0x0, word=0)
at /home/manfred/Downloads/tcl8.6.9/generic/tclBasic.c:6027
#12 0x00007ffff7dbef52 in Tcl_EvalObjEx (interp=0x55555556a990,
objPtr=0x555555616a00, flags=131072) at
/home/manfred/Downloads/tcl8.6.9/generic/tclBasic.c:6008
#13 0x00007ffff7eb5cff in Tcl_RecordAndEvalObj (interp=0x55555556a990,
cmdPtr=0x5555555b25b0, flags=131072) at
/home/manfred/Downloads/tcl8.6.9/generic/tclHistory.c:190
#14 0x00007ffff7ee87de in Tcl_MainEx (argc=-1, argv=0x7fffffffe680,
appInitProc=0x5555555551ab <Tcl_AppInit>, interp=0x55555556a990)
at /home/manfred/Downloads/tcl8.6.9/generic/tclMain.c:537
#15 0x00005555555551a4 in main (argc=1, argv=0x7fffffffe678) at
/home/manfred/Downloads/tcl8.6.9/unix/tclAppInit.c:84


Thank you

Manfred


Am 13.08.19 um 22:12 schrieb stefan:

stefan

unread,
Aug 18, 2019, 4:19:00 PM8/18/19
to
> OdbcJdbcLibrary::DescRecord*) () from /usr/local/lib/libOdbcFb.so
> #1 0x00007ffff6f5aac6 in
> OdbcJdbcLibrary::OdbcStatement::sqlGetData(int, int, void*, int, int*)
> () from /usr/local/lib/libOdbcFb.so
> #2 0x00007ffff6f24bc7 in SQLGetData () from /usr/local/lib/libOdbcFb.so
> #3 0x00007ffff71b43ce in SQLGetData () from
> /usr/lib/x86_64-linux-gnu/libodbc.so
> #4 0x00007ffff7d60999 in GetCell (rdata=0x5555556606b0,
> interp=0x55555556a990, i=0, colObjPtr=0x7fffffffe0c0)
> at
> /home/manfred/Downloads/tcl8.6.9/pkgs/tdbcodbc1.1.0/generic/tdbcodbc.c:4413

So, this is a crash in Firebird's ODBC driver implementation. How does the queried database look like, can you provide a definition script so one can re-run the crashing script? What is the exact Firebird DB version? What is the exact Firebird ODBC driver version?

Stefan

Manfred

unread,
Aug 19, 2019, 11:37:04 AM8/19/19
to
HI

Firebird Server : V3.0.4.33054
Firebird Odbc: 2.0.5.156
I use iodbc.

With tclodbc there is no Problem.

Regards
Manfred

Am 18.08.19 um 22:18 schrieb stefan:

undro...@gmail.com

unread,
Aug 19, 2019, 11:58:03 AM8/19/19
to
Manfred,

please try to switch to unixODBC instead. I bet the Firebird driver
wants to have SQL_WCHAR being a 16 bit data type. And iodbc insists
on SQL_WCHAR being wchar_t being 32 bit wide. And tdbc::odbc in theory
is able to support both. But at the end of the day there's the driver
which somehow must fit the total work of art.

And good ole tclodbc uses only SQL_CHAR interfaces...

HTH,
Christian

Manfred

unread,
Aug 19, 2019, 12:41:01 PM8/19/19
to
Hi

I used unixodbc before.
But it wasn't possible to connect to firebird.

https://groups.google.com/forum/#!topic/comp.lang.tcl/C6f3asY_FEE

regards
Manfred

Am 19.08.19 um 17:58 schrieb undro...@gmail.com:

undro...@gmail.com

unread,
Aug 19, 2019, 4:47:47 PM8/19/19
to
I see. You have indeed to use iodbc. Meanwhile had a look into the
abyss of the ODBC driver and stumbled over the assumption of
sizeof(SQL_WCHAR) == sizeof(wchar_t) there. And the firebird
packages are abandoned since Debian Jessie. Thus, either you stick
with ye olde tclodbc and its SQL_CHAR interfaces or you migrate
your DBMS to e.g. postgresql with good Linux support.

HTH,
Christian

stefan

unread,
Aug 20, 2019, 12:01:12 PM8/20/19
to
> I used unixodbc before.
> But it wasn't possible to connect to firebird.
>
> https://groups.google.com/forum/#!topic/comp.lang.tcl/C6f3asY_FEE

That was 2.3.1 back in 2011/2012, wasn't it?

You could give the latest release a try: 2.3.7.

//s

Manfred

unread,
Aug 20, 2019, 12:18:12 PM8/20/19
to
Am 20.08.19 um 18:01 schrieb stefan:
I changed 2 month ago to iodbc.
My last unixodbc version I tried was 2.3.7.

regards
Manfred

0 new messages