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

select + group by expression alias from a view kills database by signal SIGSEGV #3264

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2013-03-29 12:42:46 +0100
From: milan <<milan.martak>>
To: SQL devs <>
Version: 11.15.3 (Feb2013-SP1)
CC: @njnes

Last updated: 2013-04-29 14:51:28 +0200

Comment 18655

Date: 2013-03-29 12:42:46 +0100
From: milan <<milan.martak>>

User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0
Build Identifier:

The mclient will close connection when executing
SELECT as ... FROM GROUP BY
where is
extract(month from ) AS

merovingian.log shows there was database crash

2013-03-29 10:22:40 MSG merovingian[2446]: database 'zkdev1' (17036) was killed by signal SIGSEGV
2013-03-29 10:37:29 MSG merovingian[2446]: database 'zkdev1' has crashed after start on 2013-03-29 10:21:30, attempting restart, up min/avg/max: 2m/1d/1w, crash average: 1.00 1.00 0.60 (31-13=18)

this can be reproduced at any time - see the test case in "Steps to Reproduce"

Reproducible: Always

Steps to Reproduce:

CREATE VIEW mmtest_v AS SELECT date'2012-01-01' as period, 1 as quantity;

SELECT extract(month from period) as m, count(1) as cnt FROM mmtest_v GROUP BY m;

Actual Results:

Connection terminated + database killed by signal SIGSEGV

Expected Results:

query result, i.e.
m cnt


1 1

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffee3d5700 (LWP 25583)]
0x00007fffef493ffb in exp_alias_or_copy (sql=0x7fffe0005470, tname=0x0, cname=0x0, orel=0x0, old=0x7fffe00cd720, settname=0) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:185
185 ne = exp_column(sql->sa, nme, nme, exp_subtype(old), orel->card, has_nil(old), is_intern(old));
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-3.fc15.x86_64 cfitsio-3.280-2.fc16.x86_64 cyrus-sasl-lib-2.1.23-27.fc16.x86_64 geos-3.3.1-1.fc16.x86_64 glibc-2.14.90-24.fc16.9.x86_64 keyutils-libs-1.5.2-1.fc16.x86_64 krb5-libs-1.9.4-3.fc16.x86_64 libcom_err-1.41.14-2.fc15.x86_64 libcurl-7.21.7-8.fc16.x86_64 libgcc-4.6.3-2.fc16.x86_64 libidn-1.22-3.fc16.x86_64 libselinux-2.1.6-6.fc16.x86_64 libssh2-1.2.7-4.fc16.x86_64 libstdc++-4.6.3-2.fc16.x86_64 libuuid-2.20.1-2.3.fc16.x86_64 libxml2-2.7.8-8.fc16.x86_64 ncurses-libs-5.9-2.20110716.fc16.x86_64 nspr-4.9.4-1.fc16.x86_64 nss-3.14.1-3.fc16.x86_64 nss-softokn-freebl-3.14.1-3.fc16.x86_64 nss-util-3.14.1-1.fc16.x86_64 openldap-2.4.26-8.fc16.x86_64 openssl-1.0.0j-1.fc16.x86_64 pcre-8.12-9.fc16.x86_64 readline-6.2-2.fc16.x86_64 zlib-1.2.5-7.fc16.x86_64
(gdb) bt
0 0x00007fffef493ffb in exp_alias_or_copy (sql=0x7fffe0005470, tname=0x0, cname=0x0, orel=0x0, old=0x7fffe00cd720, settname=0) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:185
1 0x00007fffef4a2896 in rel_aggr (sql=0x7fffe0005470, rel=0x7fffee3d4900, distinct=0, aggrstr=0x7fffe00cc1e0 "count", args=0x7fffe00cc350, f=3) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:3771
2 0x00007fffef4a2d37 in rel_aggr (sql=0x7fffe0005470, rel=0x7fffee3d4900, se=0x7fffe00cc380, f=3) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:3832
3 0x00007fffef4a5992 in rel_value_exp2 (sql=0x7fffe0005470, rel=0x7fffee3d4900, se=0x7fffe00cc380, f=3, ek=..., is_last=0x7fffee3d4814) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:4543
4 0x00007fffef4a6267 in rel_value_exp (sql=0x7fffe0005470, rel=0x7fffee3d4900, se=0x7fffe00cc380, f=3, ek=...) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:4691
5 0x00007fffef4a634c in column_exp (sql=0x7fffe0005470, rel=0x7fffee3d4900, column_e=0x7fffe00cc430, f=3) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:4704
6 0x00007fffef4a65af in rel_column_exp (sql=0x7fffe0005470, rel=0x7fffee3d4900, column_e=0x7fffe00cc430, f=3) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:4748
7 0x00007fffef4a794b in rel_select_exp (sql=0x7fffe0005470, rel=0x7fffe00cd610, outer=0x0, sn=0x7fffe00cc7c0, ek=...) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:5059
8 0x00007fffef4a8ba7 in rel_query (sql=0x7fffe0005470, rel=0x0, sq=0x7fffe00cc7c0, toplevel=1, ek=...) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:5304
9 0x00007fffef4aa2fc in rel_subquery (sql=0x7fffe0005470, rel=0x0, sq=0x7fffe00cc7c0, ek=...) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:5660
10 0x00007fffef4aa393 in rel_selects (sql=0x7fffe0005470, s=0x7fffe00cc7c0) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/server/rel_select.c:5671
11 0x00007fffef49363c in rel_semantic (sql=0x7fffe0005470, s=0x7fffe00cc7c0) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/server/rel_semantic.c:263
12 0x00007fffef41ccc6 in sql_symbol2relation (c=0x7fffe0005470, sym=0x7fffe00cc7c0) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/sql/backends/monet5/sql.mx:1723
13 0x00007fffef3e93ab in SQLparser (c=0x648b28) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/sql/backends/monet5/sql_scenario.c:1666
14 0x00007ffff7a73367 in runPhase (c=0x648b28, phase=1) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/monetdb5/mal/mal_scenario.c:522
15 0x00007ffff7a7365f in runScenarioBody (c=0x648b28) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/monetdb5/mal/mal_scenario.c:587
16 0x00007ffff7a73826 in runScenario (c=0x648b28) at /ufs/manegold//Monet/HG/Feb2013/source/MonetDB/monetdb5/mal/mal_scenario.c:616
17 0x00007ffff7a748a0 in MSserveClient (dummy=0x648b28) at /ufs/manegold/
/Monet/HG/Feb2013/source/MonetDB/monetdb5/mal/mal_session.c:431
18 0x0000003cf3c07d90 in start_thread () from /lib64/libpthread.so.0
19 0x0000003cf30f119d in clone () from /lib64/libc.so.6
(gdb) li
180 } else if (!cname) {
181 char name[16], *nme;
182 nme = number2name(name, 16, ++sql->label);
183
184 exp_setname(sql->sa, old, nme, nme);
185 ne = exp_column(sql->sa, nme, nme, exp_subtype(old), orel->card, has_nil(old), is_intern(old));
186 ne->p = prop_copy(sql->sa, old->p);
187 return ne;
188 } else if (cname && !old->name) {
189 exp_setname(sql->sa, old, tname, cname);
(gdb) p sql
$1 = (mvc *) 0x7fffe0005470
(gdb) p sql->sa
$2 = (sql_allocator *) 0x7fffe007aeb0
(gdb) p *sql
$3 = {errstr = "\000ELECT: identifier 'm' unknown\000wn", '\000' <repeats 8158 times>, sa = 0x7fffe007aeb0, qc = 0x7fffe00075d0, clientid = 1, scanner = {rs = 0x7fffe8006c30, ws = 0x7fffe8004b20, log = 0x0, yynext = 0, yylast = 259, yysval = 80, yyval = 377, yycur = 81, yybak = 10 '\n',
as = 0, key = 203, started = 1, mode = LINE_N, schema = 0x0}, params = 0x0, vars = 0x7fffe0007610, topvars = 9, sizevars = 32, frame = 1, use_views = 0, args = 0x7fffe0007e30, argc = 1, argmax = 32, sym = 0x7fffe00cc7c0, point_query = 0, user_id = 3, role_id = 3, last_id = -1,
timezone = 3600000, cache = 100, caching = 100, history = 0, reply_size = -1, sizeheader = 0, debug = 0, emode = 0 '\000', emod = 0 '\000', session = 0x7fffe0007f50, type = 0, label = 1, cascade_action = 0x0, opt_stats = {0, 0, 0, 0, 0, 0, 0, 0}, result_id = 1, results = 0x0, times = {
tms_utime = 0, tms_stime = 0, tms_cutime = 0, tms_cstime = 0}, Tparse = 0}
(gdb) p *sql->sa
$4 = {size = 64, nr = 1, blks = 0x7fffe0082800, used = 6256, usedmem = 111904}
(gdb) p nme
$5 = 0x7fffee3d452d "L1"
(gdb) p old
$6 = (sql_exp *) 0x7fffe00cd720
(gdb) p *old
$7 = {type = e_atom, name = 0x7fffe00cd7b0 "L1", rname = 0x7fffe00cd7c0 "L1", l = 0x0, r = 0x0, f = 0x0, flag = 0, card = 1 '\001', tpe = {type = 0x19eb3b0, digits = 8, scale = 0, comp_type = 0x0}, used = 0, p = 0x0}
(gdb) p orel
$8 = (sql_rel *) 0x0

Comment 18656

Date: 2013-03-29 12:46:13 +0100
From: milan <<milan.martak>>

Created attachment 191
gdb trace created by Stefan M.

Attached file: gdb_trace_segfault_view_select.txt (text/plain, 6406 bytes)
Description: gdb trace created by Stefan M.

Comment 18657

Date: 2013-03-29 12:49:31 +0100
From: @njnes

fixed crash in exp_alias_or_copy, there is no enclosing orel in this case.

Comment 18658

Date: 2013-03-29 12:50:20 +0100
From: MonetDB Mercurial Repository <>

Changeset 329bbb4c5564 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=329bbb4c5564

Changeset description:

fixed bug #3264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant