[gnome-db] [Fwd: Re: gdamm1.3.4: segfault on data_model->get_n_rows(); ]



Hi everyone,

since I wasn't on the list and my mails werent's approved, here the
whole thread of the   get_n_rows()  problem.

Thank you,
 Daniel

--- Begin Message ---
Am Mittwoch, den 17.11.2004, 10:24 -0500 schrieb Carl Nygard:
> On Wed, 2004-11-17 at 07:45, Daniel Holbach wrote:
> > Hi everyone,
> > > >
> > > > This ( int rows = data_model->get_n_rows(); ) crashes my project. For a
> > > > full context see
> > > > http://cvs.berlios.de/cgi-bin/viewcvs.cgi/protosquared/protosquared/src/DBUtils.cc?rev=1.3&content-type=text/vnd.viewcvs-markup
> > > 
> 
> valgrind is complaining about null pointer, I'm guessing your data_model
> var is nil (0x0).  Check it in the debugger.  It might help you to
> install gdamm-devel package if available, but this really looks like a
> problem in your code.
> 
> in gdb:
> 
> up 4
> p data_model
> 
> I bet it comes out 0x0 (null pointer).
> 
> Regards,
> Carl
> 

Hi Carl, hello everyone else,

if you have a look at the code (link above) you'll see, that I already
check for !data_model and I do calls like 
	int columns =  data_model->get_n_columns();

But as you requested (thanks - I learned a bit by doing this), here's
the output of gdb:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1081800256 (LWP 4787)]
0x00000000 in ?? ()
(gdb) up 4
#4  0x0805551f in DBUtils::perform (this=0x8068eec, rule= 0xbffff2b0,
result= 0xbffff2a0) at refptr.h:155
155     {
(gdb) p data_model
$1 = {pCppObject_ = 0x808c3d8}
(gdb)


Have a good time,
 Daniel



_______________________________________________
gnomemm-list mailing list
gnomemm-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomemm-list

--- End Message ---
--- Begin Message ---
On Wed, 2004-11-17 at 07:45, Daniel Holbach wrote:
> Hi everyone,
> 
> 
> Am Mittwoch, den 17.11.2004, 12:28 +0100 schrieb Murray Cumming: 
> > > Hello everyone,
> > >
> > > I hope I got the right list.
> > >
> > > I'm using gdamm1.3.4 with gda1.1.99 and followed basically the examples
> > > in the tarball. I use a PostgreSQL server (on another box) and use a
> > > simple query, which works perfectly well in  pgaccess .
> > >
> > > This ( int rows = data_model->get_n_rows(); ) crashes my project. For a
> > > full context see
> > > http://cvs.berlios.de/cgi-bin/viewcvs.cgi/protosquared/protosquared/src/DBUtils.cc?rev=1.3&content-type=text/vnd.viewcvs-markup
> > >
> > > Here the last lines of an ordinary  strace -run. Hope someone can help.
> > 
> > What does the gdb backtrace look like? What does valgrind memcheck say?
> > 

valgrind is complaining about null pointer, I'm guessing your data_model
var is nil (0x0).  Check it in the debugger.  It might help you to
install gdamm-devel package if available, but this really looks like a
problem in your code.

in gdb:

up 4
p data_model

I bet it comes out 0x0 (null pointer).

Regards,
Carl


--- End Message ---
--- Begin Message ---
Hi everyone,


Am Mittwoch, den 17.11.2004, 12:28 +0100 schrieb Murray Cumming: 
> > Hello everyone,
> >
> > I hope I got the right list.
> >
> > I'm using gdamm1.3.4 with gda1.1.99 and followed basically the examples
> > in the tarball. I use a PostgreSQL server (on another box) and use a
> > simple query, which works perfectly well in  pgaccess .
> >
> > This ( int rows = data_model->get_n_rows(); ) crashes my project. For a
> > full context see
> > http://cvs.berlios.de/cgi-bin/viewcvs.cgi/protosquared/protosquared/src/DBUtils.cc?rev=1.3&content-type=text/vnd.viewcvs-markup
> >
> > Here the last lines of an ordinary  strace -run. Hope someone can help.
> 
> What does the gdb backtrace look like? What does valgrind memcheck say?
> 
> Murray Cumming
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com

Please see here the output of    gdb ./protosquared  ->   run   ->    bt
-----------------------
(gdb) run
Starting program: /home/daniel/Projects/protosquared/0.1.x/protosquared
[Thread debugging using libthread_db enabled]
[New Thread 1081800256 (LWP 31390)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1081800256 (LWP 31390)]
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x40021c5d in gda_postgres_provider_new ()
from /usr/lib/libgda/providers/libgda-postgres.so
#2  0x4015011f in gda_data_model_get_n_rows ()
from /usr/lib/libgda-2.so.1
#3  0x4012bb58 in Gnome::Gda::DataModel::get_n_rows ()
from /usr/lib/libgdamm-1.3.so.5
#4  0x0805551f in DBUtils::perform (this=0x8068eec, rule= 0xbffff2b0,
result= 0xbffff2a0) at refptr.h:155
#5  0x08059362 in Plugin_DB::get (this=0x80a2d28, rule= 0x80a2d28,
result= 0x80a2d28) at Plugin_DB.cc:94
#6  0x08057603 in PluginProxy::perform (this=0x806e7b0,
rule= 0xbffff2b0, result= 0xbffff2a0,
    simulate_only=false) at PluginProxy.cc:55
#7  0x0805662e in Network::stream_write_back (l= 0x80977d8,
s= 0x807ec30) at Network.cc:93
#8  0x08057320 in WvCallbackFunctor<WvCallback<void, WvIStreamList&,
WvStream&, void*, E, E, E, E, E>, void (*)(WvIStreamList&, WvStream&,
void*)>::operator() (this=0x80a2d28, p1= 0x80a2d28, p2= 0x80a2d28,
p3=0x80a2d28)
    at wvcallback.h:303
#9  0x0805726e in WvCallbackFunctor<WvCallback<void, WvStream&, void*,
E, E, E, E, E, E>, WvBoundCallback<WvCallback<void, WvStream&, void*, E,
E, E, E, E, E>, WvIStreamList&> >::operator() (this=0x1, p1= 0x80a2d28,
    p2=0x80a2d28) at wvcallback.h:436
#10 0x400e92ed in WvStream::_callback () from /usr/lib/libwvbase.so.4.0
#11 0x400e94a8 in WvStream::callback () from /usr/lib/libwvbase.so.4.0
#12 0x400e6689 in WvIStreamList::execute ()
from /usr/lib/libwvbase.so.4.0
#13 0x400e92c7 in WvStream::_callback () from /usr/lib/libwvbase.so.4.0
#14 0x400e94a8 in WvStream::callback () from /usr/lib/libwvbase.so.4.0
#15 0x0805611b in Network::start (this=0x80977d8) at Network.cc:45
#16 0x0805f661 in main (argc=134884648, argv=0x80a2d28) at
protosquared.cc:44
(gdb)
-----------------------


and (a snippet of the) output of:   (full output in .gz-file)
valgrind --leak-check=yes -v ./protosquared
-----------------------
==31131== Jump to the invalid address stated on the next line
==31131==    at 0x0: ???
==31131==    by 0x1BA4C11E: gda_data_model_get_n_rows
(in /usr/lib/libgda-2.so.1.1.0)
==31131==    by 0x1BA26B57: Gnome::Gda::DataModel::get_n_rows() const
(in /usr/lib/libgdamm-1.3.so.5.0.0)
==31131==    by 0x805551E: DBUtils::perform(Rule&, std::string&)
(refptr.h:155)
==31131==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==31131==
==31131== Process terminating with default action of signal 11 (SIGSEGV)
==31131==  Access not within mapped region at address 0x0
==31131==    at 0x0: ???
==31131==    by 0x1BA4C11E: gda_data_model_get_n_rows
(in /usr/lib/libgda-2.so.1.1.0)
==31131==    by 0x1BA26B57: Gnome::Gda::DataModel::get_n_rows() const
(in /usr/lib/libgdamm-1.3.so.5.0.0)
==31131==    by 0x805551E: DBUtils::perform(Rule&, std::string&)
(refptr.h:155)
==31131==
==31131== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 117 from
1)
==31131==
==31131== 1 errors in context 1 of 1:
==31131== Jump to the invalid address stated on the next line
==31131==    at 0x0: ???
==31131==    by 0x1BA4C11E: gda_data_model_get_n_rows
(in /usr/lib/libgda-2.so.1.1.0)
==31131==    by 0x1BA26B57: Gnome::Gda::DataModel::get_n_rows() const
(in /usr/lib/libgdamm-1.3.so.5.0.0)
==31131==    by 0x805551E: DBUtils::perform(Rule&, std::string&)
(refptr.h:155)
==31131==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
--31131--
--31131-- supp:  117 Ugly strchr error in /lib/ld-2.3.2.so
==31131==
==31131== IN SUMMARY: 1 errors from 1 contexts (suppressed: 117 from 1)
==31131==
==31131== malloc/free: in use at exit: 191135 bytes in 3172 blocks.
==31131== malloc/free: 10592 allocs, 7420 frees, 804720 bytes allocated.
==31131==
==31131== searching for pointers to 3172 not-freed blocks.
==31131== checked 9347016 bytes.
---------------


I hope, this gives all the answers. If you need any other information,
please tell me. (I'm not on the gnome-db-list, so you'll have to CC me)


Thanks for your attention, have a nice day,
Daniel

Attachment: valgrind.txt.gz
Description: GNU Zip compressed data

_______________________________________________
gnomemm-list mailing list
gnomemm-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomemm-list

--- End Message ---
--- Begin Message ---
> Hello everyone,
>
> I hope I got the right list.
>
> I'm using gdamm1.3.4 with gda1.1.99 and followed basically the examples
> in the tarball. I use a PostgreSQL server (on another box) and use a
> simple query, which works perfectly well in  pgaccess .
>
> This ( int rows = data_model->get_n_rows(); ) crashes my project. For a
> full context see
> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/protosquared/protosquared/src/DBUtils.cc?rev=1.3&content-type=text/vnd.viewcvs-markup
>
> Here the last lines of an ordinary  strace -run. Hope someone can help.

What does the gdb backtrace look like? What does valgrind memcheck say?

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com

--- End Message ---
--- Begin Message ---
Hello everyone,

I hope I got the right list.

I'm using gdamm1.3.4 with gda1.1.99 and followed basically the examples
in the tarball. I use a PostgreSQL server (on another box) and use a
simple query, which works perfectly well in  pgaccess .

This ( int rows = data_model->get_n_rows(); ) crashes my project. For a
full context see 
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/protosquared/protosquared/src/DBUtils.cc?rev=1.3&content-type=text/vnd.viewcvs-markup

Here the last lines of an ordinary  strace -run. Hope someone can help.

fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x407cc000
write(1, "SELECT id, name, lent_to FROM bo"..., 52SELECT id, name,
lent_to FROM books WHERE lent_to=1
) = 52
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0008SELECT id, name, lent_to FR"..., 57, 0) = 57
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0L\0\3id\0\0\0b\370\0\1\0\0\0\27\0\4\377\377\377"...,
16384, 0) = 200
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\1RSELECT c.relname FROM pg_ca"..., 339, 0) = 339
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0 \0\1relname\0\0\0\4\353\0\1\0\0\0\23\0 \377\377"...,
16384, 0) = 67
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\357SELECT 1 FROM pg_catalog.pg"..., 240, 0) = 240
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 64
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\357SELECT 1 FROM pg_catalog.pg"..., 240, 0) = 240
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 52
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\361SELECT 1 FROM pg_catalog.pg"..., 242, 0) = 242
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 52
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\361SELECT 1 FROM pg_catalog.pg"..., 242, 0) = 242
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 52
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\364SELECT 1 FROM pg_catalog.pg"..., 245, 0) = 245
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 52
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
send(5, "Q\0\0\0\364SELECT 1 FROM pg_catalog.pg"..., 245, 0) = 245
rt_sigaction(SIGPIPE, {SIG_DFL}, {SIG_IGN}, 8) = 0
poll([{fd=5, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
recv(5, "T\0\0\0!\0\1?column?\0\0\0\0\0\0\0\0\0\0\27\0\4\377\377"...,
16384, 0) = 52
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++




Have a good time,
 Daniel




_______________________________________________
gnomemm-list mailing list
gnomemm-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomemm-list

--- End Message ---
--- Begin Message ---
Hai,

Am Mittwoch, den 17.11.2004, 19:58 +0100 schrieb Murray Cumming:
> It would be more interesting to dig a little deeper and see what really
> is 0. Maybe it's the GdaDataModel*, though Gda::DataModel::operator bool
> () should have checked that.

I'm not quite sure how or where to dig at all, but here is what I found
out after some (separated) testing:

works: 
GdaDataModel* gdadm = data_model->gobj();
std::cout <<
gda_value_stringify(const_cast<GdaValue*>(gda_data_model_get_value_at(gdadm,1,0))) << std::endl;

doesnt work:
std::cout << gda_data_model_get_n_rows(gdadm) << std::endl;

doesnt work either:
std::cout << data_model->get_value_at(1, 0).to_string();

I'll try anything you suggest, thanks for your patience,
 Daniel


_______________________________________________
gnomemm-list mailing list
gnomemm-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomemm-list

--- End Message ---
--- Begin Message ---
On Wed, 2004-11-17 at 17:38 +0100, Daniel Holbach wrote:
> if you have a look at the code (link above) you'll see, that I already
> check for !data_model and I do calls like 
> 	int columns =  data_model->get_n_columns();
> 
> But as you requested (thanks - I learned a bit by doing this), here's
> the output of gdb:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1081800256 (LWP 4787)]
> 0x00000000 in ?? ()
> (gdb) up 4
> #4  0x0805551f in DBUtils::perform (this=0x8068eec, rule= 0xbffff2b0,
> result= 0xbffff2a0) at refptr.h:155
> 155     {
> (gdb) p data_model
> $1 = {pCppObject_ = 0x808c3d8}
> (gdb)

It would be more interesting to dig a little deeper and see what really
is 0. Maybe it's the GdaDataModel*, though Gda::DataModel::operator bool
() should have checked that.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]