This bugzilla instance is closed for business. At this moment we are copying the contents to our github bugtracker which will take over the work once it is done.
Bug 2607 - GDK: gdk_bbp.c:2257: BBPfree: Assertion `b->P->sharecnt == 0' failed
Summary: GDK: gdk_bbp.c:2257: BBPfree: Assertion `b->P->sharecnt == 0' failed
Status: RESOLVED FIXED
Alias: None
Product: GDK kernel
Classification: Unclassified
Component: all (show other bugs)
Version: 1.40.1 (Oct2010) [obsolete]
Hardware: x86_64 (amd64/em64t) Linux
: Normal normal
Assignee: GDK devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 12:47 CEST by Ying Zhang
Modified: 2010-11-15 09:39 CET (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ying Zhang cwiconfidential 2010-07-13 12:47:40 CEST
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.7) Gecko/20100701 Firefox/3.6.7
Build Identifier: 

Running the query 'select min(vcnt), max(vcnt), avg(vcnt) from tofsims_naive_direct_valuecount;' using the HEAD branch with '--set sql_optimizer=nov2009_pipe' triggers an assertion in BBPfree.  This error does not occur when the default_pipe is used, and it does not occur in the Feb2010 and Jun2010 branched (using the nov2009_pipe).

The HEAD branch was installed yesterday afternoon around 16:00 using 'monetdb-install.sh --prefix=[...] --enable-sql --enable-geom --enable-debug'

Reproducible: Always

Steps to Reproduce:
1. copy the dbfarm from /export/scratch1/zhang/MonetDB-current/var/MonetDB5/dbfarm/demo/ from the INS1 machine 'slippy'. It is ~16GB.
2. start: gdb --args mserver5 --set sql_optimizer=nov2009_pipe
3. start: mclient -ls -t and run the query 'select min(vcnt), max(vcnt), avg(vcnt) from tofsims_naive_direct_valuecount;'
4. wait until you get a SIGABRT

If copying dbfarm from slippy doesn't work, it can be built as the following:

1. copy the raw data from the INS1 machine 'jarl': /export/scratch0/zhang/tofsims/tofsims.*
2. execute these sql stmts:

create table tofsims_naive_direct (x int, y int, val int);
copy into tofsims_naive_direct from ('[pathto]/tofsims.x', '[pathto]/tofsims.y', '[pathto]/tofsims.v');
create view tofsims_naive_direct_valuecount as select x,y,count(val) as vcnt from tofsims_naive_direct group by x, y;
Actual Results:  
Output of GDB that might be interesting:

Starting program: /export/scratch1/zhang/MonetDB-current/bin/mserver5 --set sql_optimizer=nov2009_pipe
[Thread debugging using libthread_db enabled]
[New Thread 0x7fffea656710 (LWP 23086)]
# MonetDB server v5.21.0, based on kernel v1.39.0
# Serving database 'demo', using 4 threads
# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked
# Found 7.752 GiB available main-memory.
# Copyright (c) 1993-July 2008 CWI.
# Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
# Visit http://monetdb.cwi.nl/ for further information
#warning: please don't forget to set your vault key!
#(see /export/scratch1/zhang/MonetDB-current/etc/monetdb5.conf)
#WARNING: LoaderException:loadLibrary:Loading error 'libmseed.so.2: cannot open shared object file: No such file or directory' from within file 'vault'
[New Thread 0x7fffdf87e710 (LWP 23091)]
# Listening for connection requests on mapi:monetdb://127.0.0.1:50000/
# MonetDB/SQL module v2.39.0 loaded
[New Thread 0x7fffdf67d710 (LWP 23092)]
# MonetDB/GIS module v0.19.0 loaded
>[New Thread 0x7fffdf47c710 (LWP 23095)]
[New Thread 0x7fffdf27b710 (LWP 23096)]
[New Thread 0x7fffdf07a710 (LWP 23097)]
[New Thread 0x7fffdee79710 (LWP 23098)]
[New Thread 0x7fffdec78710 (LWP 23099)]

>mserver5: gdk_bbp.c:2257: BBPfree: Assertion `b->P->sharecnt == 0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffea656710 (LWP 23086)]
0x000000334a2326c5 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-6.fc12.x86_64 cyrus-sasl-lib-2.1.23-9.fc12.x86_64 geos-3.2.1-1.fc12.x86_64 glibc-2.11.2-1.x86_64 keyutils-libs-1.2-6.fc12.x86_64 krb5-libs-1.7.1-9.fc12.x86_64 libcom_err-1.41.9-7.fc12.x86_64 libcurl-7.19.7-10.fc12.x86_64 libgcc-4.4.4-10.fc12.x86_64 libidn-1.9-5.x86_64 libselinux-2.0.90-5.fc12.x86_64 libssh2-1.2.4-1.fc12.x86_64 libstdc++-4.4.4-10.fc12.x86_64 libuuid-2.16.2-9.fc12.x86_64 libxml2-2.7.6-2.fc12.x86_64 libxslt-1.1.26-1.fc12.x86_64 ncurses-libs-5.7-3.20090207.fc12.x86_64 nspr-4.8.4-2.fc12.x86_64 nss-3.12.6-7.fc12.x86_64 nss-softokn-freebl-3.12.6-2.fc12.1.x86_64 nss-util-3.12.6-1.fc12.x86_64 openldap-2.4.19-4.fc12.x86_64 openssl-1.0.0a-1.fc12.x86_64 pcre-7.8-3.fc12.x86_64 raptor-1.4.18-5.fc12.x86_64 readline-6.0-3.fc12.x86_64 zlib-1.2.3-23.fc12.x86_64


Expected Results:  
+------+-------+------------------------+
| L5   | L6    | L7                     |
+======+=======+========================+
|    1 | 20509 |     1.7357339598738226 |
+------+-------+------------------------+
1 tuple


Sjoer has helped me to hunt the bug.  The assertion was triggered by that BBPfree was called by BBPtrims to free a BAT with sharecnt == 1.  Most probably, this BAT has been (incorrectly) added to 'bbptrim' because 'BBPtrimmable' does not check the 'sharecnt' of a BAT.

What supprises me a bit is that (without gdb) the assertion does not cause mserver5 to exit.  With gdb, it can be seen that the thread that raises the assertion is a kind of stuck, and since all other threads are waiting for this thread, it causes mserver5 to hang.
Comment 1 Stefan de Konink 2010-07-15 05:01:56 CEST
This bug [do notice the different linenumbers] hits me now too, with nothing more than a select * from mytable query. And having the default_pipe selected.

/opt/monetdb-testing/bin/mserver5 --dbinit="include sphinx;" --dbname="rechtspraak" --dbfarm=/mnt/data/monetdb-testing --set mapi_port=60003 --set sql_optimizer=default_pipe
# MonetDB server v5.21.0, based on kernel v1.39.0
# Serving database 'rechtspraak', using 2 threads
# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked
# Found 3.865 GiB available main-memory.
# Copyright (c) 1993-July 2008 CWI.
# Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
# Visit http://monetdb.cwi.nl/ for further information
#warning: please don't forget to set your vault key!
#(see /opt/monetdb-testing/etc/monetdb5.conf)
# Listening for connection requests on mapi:monetdb://127.0.0.1:60003/
# MonetDB/SQL module v2.39.0 loaded
>mserver5: ../../../src/gdk/gdk_bbp.mx:2367: BBPfree: Assertion `b->P->sharecnt == 0' failed.
Afgebroken

query;
select id, ljn, gepubliceerd, instantie, datum, publicatie, zaaknummers, uitspraak, conclusie, zittingsplaats, rechtsgebied, sector, soort, indicatie, kop from uitspraken

(yes that is required for full text search)



MonetDB server v5.21.0 (64-bit), based on kernel v1.39.0 (64-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
Visit http://monetdb.cwi.nl/ for further information
Found 3.9GiB available memory, 2 available cpu cores
Configured for prefix: /opt/monetdb-testing
Libraries:
  libpcre: 8.02 2010-03-19 (compiled with 8.02)
  openssl: OpenSSL 0.9.8o 01 Jun 2010 (compiled with OpenSSL 0.9.8o 01 Jun 2010)
  libxml2: 2.7.7 (compiled with 2.7.7)
Compiled by: skinkie@openkvk (x86_64-unknown-linux-gnu)
Compilation: gcc -Wall -Wextra -fno-strict-aliasing -g  -Werror-implicit-function-declaration -Werror -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wp,-D_FORTIFY_SOURCE=2
Linking    : /usr/x86_64-pc-linux-gnu/bin/ld -IPA -m elf_x86_64
Comment 2 Stefan Manegold cwiconfidential 2010-07-15 09:06:44 CEST
FYI:
re. "[do notice the different linenumbers]":
different line numbers are due to different files:
Jennie: gdk_bbp.c (pre-bootstrapped .c file from super source ball)
Stefan: gdk_bbp.mx (original .mx source file from HG repository)
Comment 3 Fabian Groffen 2010-10-28 13:24:18 CEST
Jennie recalls this bug was fixed.