Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mserver5 restart aborts/segfaults after dropping column with constraint #6749

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels
bug Something isn't working major SQL

Comments

@monetdb-team
Copy link

Date: 2019-08-18 14:50:39 +0200
From: @drstmane
To: SQL devs <>
Version: 11.33.3 (Apr2019)
CC: @PedroTadim

Last updated: 2019-09-02 16:05:26 +0200

Comment 27230

Date: 2019-08-18 14:50:39 +0200
From: @drstmane

when trying to restart the MonetDB server (mserver5) after having dropped with "cascade" a column that holds a (unique) constraint,
the restart fails with a segfault (non-debug build), respectively aborts with

mserver5: .../MonetDB/sql/storage/store.c:276: load_keycolumn: Assertion `kc->c' failed.

(debug build)

Comment 27231

Date: 2019-08-18 14:56:23 +0200
From: @drstmane

This bug appears with Apr2019_release (Apr2019_3), Apr2019_SP1_release (Apr2019_7) and current head of Apr2019 branch (changeset 6eda988176b3).

Comment 27232

Date: 2019-08-18 15:01:22 +0200
From: @drstmane

Created attachment 625
test script

Attached file: Bug-6749.sh (application/x-shellscript, 1680 bytes)
Description: test script

Comment 27234

Date: 2019-08-19 10:05:02 +0200
From: MonetDB Mercurial Repository <>

Changeset 965b25376303 made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=965b25376303

Changeset description:

Added test for bug #6749

Comment 27235

Date: 2019-08-19 13:47:37 +0200
From: MonetDB Mercurial Repository <>

Changeset 925022b81bac made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=925022b81bac

Changeset description:

Fix for bug #6749 (i.e. when copying the key definition to the transaction's table, create a dependency for unique keys as well)

Comment 27239

Date: 2019-08-19 17:13:36 +0200
From: @drstmane

Hi Pedro,

thanks for your fix!

While this indeed seems to work for the provided test case,
in my larger case (on propriatory data),
mserver5 5 now segfaults during the "drop columns .. cascade" ...

I still need to understand what extra code (or different data?) in my larger test case triggers this segfault ...

Comment 27240

Date: 2019-08-19 17:41:23 +0200
From: @drstmane

segfault when drop is in same transaction as create:

$ cat Bug-6749.sql
start transaction;
create table t (a int, b int, c int);
alter table t add unique (b);
\d t
select * from t;
alter table t drop column b cascade;
\d t
select * from t;
commit;
select * from t;
\d t
drop table t;
\d t
select * from t;

$ mclient -p50505 -dMyDB -i -e < Bug-6749.sql
start transaction;
auto commit mode: off
create table t (a int, b int, c int);
operation successful
alter table t add unique (b);
operation successful
CREATE TABLE "sys"."t" (
"a" INTEGER,
"b" INTEGER,
"c" INTEGER,
CONSTRAINT "t_b_unique" UNIQUE ("b")
);
select * from t;
+---+---+---+
| a | b | c |
+===+===+===+
+---+---+---+
0 tuples

Thread 61 "mserver5" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd2199700 (LWP 7206)]
sys_drop_key (tr=0x25d4640, k=0x26da830, drop_action=1) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/storage/store.c:4366
4366 for (n = k->columns->h; n; n = n->next) {
Missing separate debuginfos, use: dnf debuginfo-install R-core-3.5.0-4.fc28.x86_64 SuperLU-5.2.0-7.fc28.x86_64 armadillo-8.600.0-1.fc28.x86_64 arpack-3.5.0-6.fc28.x86_64 atlas-3.10.3-5.fc28.x86_64 blas-3.8.0-9.fc28.x86_64 boost-atomic-1.66.0-8.fc28.x86_64 boost-chrono-1.66.0-8.fc28.x86_64 boost-date-time-1.66.0-8.fc28.x86_64 boost-filesystem-1.66.0-8.fc28.x86_64 boost-iostreams-1.66.0-8.fc28.x86_64 boost-program-options-1.66.0-8.fc28.x86_64 boost-regex-1.66.0-8.fc28.x86_64 boost-system-1.66.0-8.fc28.x86_64 boost-thread-1.66.0-8.fc28.x86_64 bzip2-libs-1.0.6-26.fc28.x86_64 cfitsio-3.430-1.fc28.x86_64 cyrus-sasl-lib-2.1.27-0.2rc7.fc28.x86_64 expat-2.2.5-3.fc28.x86_64 fontconfig-2.13.0-4.fc28.x86_64 freetype-2.8-10.fc28.x86_64 freexl-1.0.5-1.fc28.x86_64 gdal-libs-2.2.4-2.fc28.x86_64 geos-3.6.1-8.fc28.x86_64 giflib-5.1.4-1.fc28.x86_64 hdf5-1.8.20-3.fc28.x86_64 jasper-libs-2.0.14-5.fc28.x86_64 jbigkit-libs-2.1-12.fc28.x86_64 json-c-0.13.1-2.fc28.x86_64 keyutils-libs-1.5.10-6.fc28.x86_64 krb5-libs-1.16.1-13.fc28.x86_64 lapack-3.8.0-9.fc28.x86_64 laszip-2.2.0-10.fc28.x86_64 lcms2-2.9-2.fc28.x86_64 libaec-1.0.2-3.fc28.x86_64 libatomic_ops-7.6.2-3.fc28.x86_64 libcom_err-1.44.2-0.fc28.x86_64 libcurl-7.59.0-5.fc28.x86_64 libdap-3.18.3-4.fc27.x86_64 libgcc-8.1.1-5.fc28.x86_64 libgeotiff-1.4.0-12.fc28.x86_64 libgfortran-8.1.1-5.fc28.x86_64 libgomp-8.1.1-5.fc28.x86_64 libgta-1.0.7-7.fc28.x86_64 libicu-60.2-2.fc28.x86_64 libidn2-2.0.5-1.fc28.x86_64 libjpeg-turbo-1.5.3-6.fc28.x86_64 libkml-1.3.0-10.fc28.x86_64 liblas-1.8.0-21.fc28.x86_64 libnghttp2-1.32.0-1.fc28.x86_64 libpng-1.6.34-6.fc28.x86_64 libpsl-0.20.2-2.fc28.x86_64 libquadmath-8.1.1-5.fc28.x86_64 libselinux-2.8-1.fc28.x86_64 libspatialite-4.3.0a-8.fc28.x86_64 libssh-0.7.5-7.fc28.x86_64 libstdc++-8.1.1-5.fc28.x86_64 libtiff-4.0.9-10.fc28.x86_64 libtirpc-1.0.3-3.rc2.fc28.x86_64 libtool-ltdl-2.4.6-24.fc28.x86_64 libunistring-0.9.10-1.fc28.x86_64 libuuid-2.32.1-1.fc28.x86_64 libwebp-1.0.0-1.fc28.x86_64 libxcrypt-4.1.1-4.fc28.x86_64 libxml2-2.9.8-4.fc28.x86_64 lz4-libs-1.8.1.2-4.fc28.x86_64 mariadb-connector-c-3.0.5-1.fc28.x86_64 minizip-1.2.11-8.fc28.x86_64 ncurses-libs-6.1-5.20180224.fc28.x86_64 netcdf-4.4.1.1-9.fc28.x86_64 nspr-4.19.0-1.fc28.x86_64 nss-3.38.0-1.0.fc28.x86_64 nss-util-3.38.0-1.0.fc28.x86_64 ogdi-3.2.1-1.fc28.x86_64 openblas-Rblas-0.3.2-1.fc28.x86_64 openblas-openmp-0.3.2-1.fc28.x86_64 openblas-threads-0.3.2-1.fc28.x86_64 openjpeg2-2.3.0-6.fc28.x86_64 openldap-2.4.46-2.fc28.x86_64 openssl-libs-1.1.0h-3.fc28.x86_64 pcre-8.42-2.fc28.x86_64 pcre2-10.31-8.fc28.x86_64 poppler-0.62.0-4.fc28.x86_64 postgresql-libs-10.4-1.fc28.x86_64 proj-4.9.3-6.fc28.x86_64 readline-7.0-11.fc28.x86_64 snappy-1.1.7-5.fc28.x86_64 sqlite-libs-3.22.0-4.fc28.x86_64 tre-0.8.0-22.20140228gitc2f5d13.fc28.x86_64 unixODBC-2.3.5-3.fc28.x86_64 uriparser-0.8.5-1.fc28.x86_64 xerces-c-3.2.1-1.fc28.x86_64 xz-libs-5.2.4-2.fc28.x86_64 zlib-1.2.11-8.fc28.x86_64
(gdb) bt
0 sys_drop_key (tr=0x25d4640, k=0x26da830, drop_action=1) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/storage/store.c:4366
1 0x00007fffeebd7320 in sql_trans_drop_key (tr=0x25d4640, s=0x2650860, id=8978, drop_action=1) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/storage/store.c:6191
2 0x00007fffeebccf32 in sql_trans_drop_all_dependencies (tr=0x25d4640, s=0x2650860, id=8975, type=3) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/storage/store.c:4270
3 0x00007fffeebce0d6 in sys_drop_column (tr=0x25d4640, col=0x26da480, drop_action=2) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/storage/store.c:4505
4 0x00007fffeebd4da3 in sql_trans_drop_column (tr=0x25d4640, t=0x26da180, id=8975, drop_action=2) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/storage/store.c:5731
5 0x00007fffeeaf05b8 in mvc_drop_column (m=0x7fff4000b750, t=0x26da180, col=0x26da480, drop_action=1) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/server/sql_mvc.c:1394
6 0x00007fffeea6e777 in alter_table (cntxt=0x7fffefe4d380, sql=0x7fff4000b750, sname=0x7fff40136ae0 "sys", t=0x7fff40229b70) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/backends/monet5/sql_cat.c:847
7 0x00007fffeea70878 in SQLalter_table (cntxt=0x7fffefe4d380, mb=0x7fff401e1a00, stk=0x7fff40134ab0, pci=0x7fff40135980) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/backends/monet5/sql_cat.c:1140
8 0x00007ffff79ccd57 in runMALsequence (cntxt=0x7fffefe4d380, mb=0x7fff401e1a00, startpc=1, stoppc=0, stk=0x7fff40134ab0, env=0x0, pcicaller=0x0) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/monetdb5/mal/mal_interpreter.c:647
9 0x00007ffff79cb3e1 in runMAL (cntxt=0x7fffefe4d380, mb=0x7fff401e1a00, mbcaller=0x0, env=0x0) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/monetdb5/mal/mal_interpreter.c:336
10 0x00007fffeea451b2 in SQLrun (c=0x7fffefe4d380, be=0x7fff40004500, m=0x7fff4000b750) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/backends/monet5/sql_execute.c:384
11 0x00007fffeea46ce0 in SQLengineIntern (c=0x7fffefe4d380, be=0x7fff40004500) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/sql/backends/monet5/sql_execute.c:809
12 0x00007fffeea433fc in SQLengine (c=0x7fffefe4d380) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/sql/backends/monet5/sql_scenario.c:1381
13 0x00007ffff79f9601 in runPhase (c=0x7fffefe4d380, phase=4) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/monetdb5/mal/mal_scenario.c:517
14 0x00007ffff79f979d in runScenarioBody (c=0x7fffefe4d380, once=0) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/monetdb5/mal/mal_scenario.c:547
15 0x00007ffff79f99ce in runScenario (c=0x7fffefe4d380, once=0) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/monetdb5/mal/mal_scenario.c:580
16 0x00007ffff79fb7e1 in MSserveClient (c=0x7fffefe4d380) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/monetdb5/mal/mal_session.c:525
17 0x00007ffff79fb2a6 in MSscheduleClient (command=0x7fff40000b30 "0B", challenge=0x7fffd2198cbb "T1fEySDwZ", fin=0x7fff40002b90, fout=0x7fffcc002da0, protocol=PROTOCOL_9, blocksize=8190)
at /export/scratch1/home/manegold//Monet/release/source/MonetDB/monetdb5/mal/mal_session.c:403
18 0x00007ffff7aa8909 in doChallenge (data=0x7fffcc000b30) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/monetdb5/modules/mal/mal_mapi.c:271
19 0x00007ffff753dcfb in THRstarter (a=0x7fffcc004e90) at /export/scratch1/home/manegold//Monet/release/source/MonetDB/gdk/gdk_utils.c:1415
20 0x00007ffff75b7d61 in thread_starter (arg=0x2212e00) at /export/scratch1/home/manegold/
/Monet/release/source/MonetDB/gdk/gdk_system.c:650
21 0x00007ffff4611594 in start_thread () from /lib64/libpthread.so.0
22 0x00007ffff43450df in clone () from /lib64/libc.so.6
(gdb) l
4361
4362 if (is_oid_nil(rid))
4363 return ;
4364 table_funcs.table_delete(tr, syskey, rid);
4365
4366 for (n = k->columns->h; n; n = n->next) {
4367 sql_kc kc = n->data;
4368 sys_drop_kc(tr, k, kc);
4369 }
4370 /
remove key from schema */
(gdb) p rid
$1 = 24
(gdb) p k
$2 = (sql_key *) 0x26da830
(gdb) p *k
$3 = {base = {wtime = 0, rtime = 0, stime = 0, allocated = 0, flags = 1, refcnt = 1, id = 8978, name = 0x26da890 "t_b_unique"}, type = ukey, idx = 0x26da620, columns = 0x0, t = 0x26da180, drop_action = 0}
(gdb) p k->columns
$4 = (struct list *) 0x0
(gdb)

Comment 27242

Date: 2019-08-19 20:01:04 +0200
From: MonetDB Mercurial Repository <>

Changeset ccf704516cc6 made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=ccf704516cc6

Changeset description:

More fixes for bug #6749 (i.e. when dropping a key, clean the key from the table's keyset only after removing the underlying storage information (dependant action))

Comment 27243

Date: 2019-08-19 20:03:51 +0200
From: @PedroTadim

Thank you Dr. Stefan for your reports. I just committed a fix for your latest issue.

@monetdb-team monetdb-team added bug Something isn't working major SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major SQL
Projects
None yet
Development

No branches or pull requests

2 participants