freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] bsqldb crashes, fisql does not give the desired results
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] bsqldb crashes, fisql does not give the desired results
- Date: Wed, 2 Jul 2014 21:21:33 +0100
2014-07-02 17:33 GMT+01:00 Frantisek Hanzlik <franta AT hanzlici.cz>:
> I'm absolute newbie in SQL, thus please forgive me if I do something
> stupid.
> I tried run this script (which is working fine with
> \Program Files\Microsoft SQL Server\90\Tools\Binn\osql.exe
> from MS SQL server 2005 on Windows 2003 server) :
>
>
> --- script begin
> declare
> @CityOd varchar(10),
> @CityDo varchar(10),
> @datumStavu datetime
>
> set @CityOd = 'ADAMOV'
> set @CityDo = 'WIEN'
> set @datumStavu = '2014-07-02'
>
> create table #tmp(no_ varchar(20), up decimal(38,20),
> s12 decimal(38,20), s14 decimal(38,20), s5416 decimal(38,20))
> declare c cursor for
> select No_, [Unit Price] from [MyDB$Item] k
> where [Item Category Code] = 'E-SHOP'
>
> declare @no varchar(20),
> @up decimal(38,20),
> @s12 decimal(38,20),
> @s14 decimal(38,20),
> @s5416 decimal(38,20)
>
> open c
> fetch c into @no, @up
> while @@fetch_status=0
> begin
> SELECT @s12 = isnull(SUM([s12]),0),@s14=isnull(SUM([s14]),0) FROM
> [MyDB$TBL1]
> WITH (READUNCOMMITTED) WHERE (bucket=5 AND f2=@no AND
> ((f8>=@CityOd AND f8<=@CityDo)))
> AND f3 < @datumStavu
>
> SELECT @s5416=isnull(SUM([s5416]),0) FROM [MyDB$TBL2] WITH
> (READUNCOMMITTED)
> WHERE (bucket=6 AND f1=1 AND f5=2 AND f6=@no AND ((f7>=@CityOd AND
> f7<=@CityDo)))
> and f10 < @datumStavu
>
> insert into #tmp values(@no, @up, @s12, @s14, @s5416)
> fetch c into @no, @up
> end
> close c
> deallocate c
> select * from #tmp
> drop table #tmp
> go
> --- script end
>
>
I think this can be written again using a single select statement. However,
not the problem
> on bsqldb and fisql from freetds-0.91-6.gitf3ae29d.fc19.x86_64 on
> Fedora 19 x86_64.
>
> When I run bsqldb with params:
> -i SQL -U user -P pwd -S sqlsrv -D test -t " " -e SQLerr -o SQLout -h -v
>
> *** Error in `/bin/bsqldb': free(): invalid pointer: 0x000000000064ae00 ***
> ======= Backtrace: =========
> /lib64/libc.so.6[0x3b2607d0b8]
> /lib64/libsybdb.so.5(dbnextrow+0x369)[0x3ec820e1b9]
> /bin/bsqldb[0x40308b]
> /bin/bsqldb[0x4022a2]
> /lib64/libc.so.6(__libc_start_main+0xf5)[0x3b26021b45]
> /bin/bsqldb[0x402431]
> ======= Memory map: ========
> 00400000-00406000 r-xp 00000000 09:01 1736030
> /usr/bin/bsqldb
> 00605000-00606000 r--p 00005000 09:01 1736030
> /usr/bin/bsqldb
> 00606000-0060a000 rw-p 00006000 09:01 1736030
> /usr/bin/bsqldb
> 0060a000-0064f000 rw-p 00000000 00:00 0
> [heap]
> 3974200000-3974279000 r-xp 00000000 09:01 1707453
> /usr/lib64/libfreebl3.so
> 3974279000-3974478000 ---p 00079000 09:01 1707453
> /usr/lib64/libfreebl3.so
> ...
> 7ffff1ab2000-7ffff7fd7000 r--p 00000000 09:01 1734848
> /usr/lib/locale/locale-archive
> 7ffff7fd7000-7ffff7fe3000 rw-p 00000000 00:00 0
> 7ffff7ff1000-7ffff7ff4000 rw-p 00000000 00:00 0
> 7ffff7ff4000-7ffff7ffb000 r--s 00000000 09:01 1734941
> /usr/lib64/gconv/gconv-modules.cache
> 7ffff7ffb000-7ffff7ffd000 rw-p 00000000 00:00 0
> 7ffff7ffd000-7ffff7fff000 r-xp 00000000 00:00 0
> [vdso]
> 7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0
> [stack]
> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
> [vsyscall]
>
> Program received signal SIGABRT, Aborted.
> 0x0000003b260359e9 in __GI_raise (sig=sig@entry=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> 56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
>
> And stack backtrace is:
> #0 0x0000003b260359e9 in __GI_raise (sig=sig@entry=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> #1 0x0000003b260370f8 in __GI_abort () at abort.c:90
> #2 0x0000003b26075d17 in __libc_message (do_abort=do_abort@entry=2,
> fmt=fmt@entry=0x3b2617e568 "*** Error in `%s': %s: 0x%s ***\n") at
> ../sysdeps/unix/sysv/linux/libc_fatal.c:196
> #3 0x0000003b2607d0b8 in malloc_printerr (ptr=<optimized out>,
> str=0x3b2617bc75 "free(): invalid pointer", action=3) at malloc.c:4937
> #4 _int_free (av=0x3b263ba780 <main_arena>, p=<optimized out>,
> have_lock=0) at malloc.c:3789
> #5 0x0000003ec820e1b9 in buffer_add_row (resinfo=0x614440,
> dbproc=0x6133c0) at buffering.h:500
> #6 dbnextrow (dbproc=dbproc@entry=0x6133c0) at dblib.c:2071
> #7 0x000000000040308b in print_results (dbproc=dbproc@entry=0x6133c0) at
> bsqldb.c:535
> #8 0x00000000004022a2 in main (argc=<optimized out>, argv=0x7fffffffe508)
> at bsqldb.c:210
>
>
This is surely a bug of FreeTDS
>
> When I tried run this SQL script with 'fisql' with params:
> -i SQL -U user -P pwd -S sqlsrv -D test -e SQLerr -o SQLout -w 65500 -n
>
> then program run seemingly without error, but SQLout output is weird:
>
> no_
> up s12 s14 s5416
> --------------------------------------------------------------------------------
> -- --- --- -----
> DB-LIBRARY error:
> Data conversion resulted in overflow
> Operating-system error:
> Success
> K2030446
> -- --- --- -----
> DB-LIBRARY error:
> Data conversion resulted in overflow
> Operating-system error:
> Success
> K2030457
> -- --- --- -----
> DB-LIBRARY error:
> Data conversion resulted in overflow
> Operating-system error:
> Success
> K2030469
> -- --- --- -----
> DB-LIBRARY error:
> Data conversion resulted in overflow
> Operating-system error:
> Success
> K2030471
> -- --- --- -----
> ...
>
>
Here possibly fisql is not allocating correctly output buffers
>
> Can anyone advise me what I'm doing wrong?
>
> Thanks in advance, Franta Hanzlik
>
>
>
I'll try to run the same query.
Frediano
-
[freetds] bsqldb crashes, fisql does not give the desired results,
Frantisek Hanzlik, 07/02/2014
- Re: [freetds] bsqldb crashes, fisql does not give the desired results, Frediano Ziglio, 07/02/2014
-
Re: [freetds] bsqldb crashes, fisql does not give the desired results,
Frediano Ziglio, 07/02/2014
- Re: [freetds] bsqldb crashes, fisql does not give the desired results, Frantisek Hanzlik, 07/02/2014
- Re: [freetds] bsqldb crashes, fisql does not give the desired results, Frantisek Hanzlik, 07/03/2014
Archive powered by MHonArc 2.6.24.