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

Segmentation fault using a column inside of a functioncall #2740

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

Segmentation fault using a column inside of a functioncall #2740

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


Copy link

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

Date: 2010-12-04 21:00:14 +0100
From: @skinkie
To: SQL devs <>
Version: 11.5.1 (Aug2011) [obsolete]
CC: @njnes

Last updated: 2012-01-26 15:32:07 +0100

Comment 15278

Date: 2010-12-04 21:00:14 +0100
From: @skinkie

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.210 Safari/534.10
Build Identifier:

create table tags_tmp (word varchar(265), counts integer not null);
copy 53681 records into tags_tmp from '/tmp/keywords.tsv' delimiters '\t', '\n' null as '';
create table tags (word varchar(265), counts integer not null, doccounts integer not null);
create function sphinx_searchIndexLimit(query string, idx string, "limit" int) returns table (id bigint) external name sphinx."sphinx_searchIndexLimit";
insert into tags select word, counts, (select count(*) from sphinx_searchIndexLimit(word, 'index', 1000)) as doccounts from tags_tmp;

This results in:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe335a710 (LWP 20123)]
0x00007fffe403e8ff in flatten_exps (sql=0x1554758, exps=0x0) at ../../../src/server/
3395 for (n=exps->h; n; n=n->next) {
(gdb) bt
0 0x00007fffe403e8ff in flatten_exps (sql=0x1554758, exps=0x0) at ../../../src/server/
1 0x00007fffe403ed83 in _rel_aggr (sql=0x1554758, rel=0x7fffe3359490, distinct=0, aggrstr=0x170d278 "count", sym=0x0, f=3) at ../../../src/server/
2 0x00007fffe403f1dd in rel_aggr (sql=0x1554758, rel=0x7fffe3359490, se=0x170d338, f=3) at ../../../src/server/
3 0x00007fffe4041386 in rel_value_exp2 (sql=0x1554758, rel=0x7fffe3359490, se=0x170d338, f=3, ek=..., is_last=0x7fffe3359394) at ../../../src/server/
4 0x00007fffe4041ac9 in rel_value_exp (sql=0x1554758, rel=0x7fffe3359490, se=0x170d338, f=3, ek=...) at ../../../src/server/
5 0x00007fffe4041b94 in column_exp (sql=0x1554758, rel=0x7fffe3359490, column_e=0x170d3d8, f=3) at ../../../src/server/
6 0x00007fffe4041cd8 in rel_column_exp (sql=0x1554758, rel=0x7fffe3359490, column_e=0x170d3d8, f=3) at ../../../src/server/
7 0x00007fffe4042f82 in rel_select_exp (sql=0x1554758, rel=0xb149b8, outer=0xb2abc8, sn=0x170d9d8, ek=...) at ../../../src/server/
8 0x00007fffe4043ccb in rel_query (sql=0x1554758, rel=0xb2abc8, sq=0x170d9d8, toplevel=0, ek=...) at ../../../src/server/
9 0x00007fffe404514a in rel_subquery (sql=0x1554758, rel=0xb2abc8, sq=0x170d9d8, ek=...) at ../../../src/server/
10 0x00007fffe4041839 in rel_value_exp2 (sql=0x1554758, rel=0x7fffe3359870, se=0x170d9d8, f=3, ek=..., is_last=0x7fffe3359774) at ../../../src/server/
11 0x00007fffe4041ac9 in rel_value_exp (sql=0x1554758, rel=0x7fffe3359870, se=0x170d9d8, f=3, ek=...) at ../../../src/server/
12 0x00007fffe4041b94 in column_exp (sql=0x1554758, rel=0x7fffe3359870, column_e=0x170dae8, f=3) at ../../../src/server/
13 0x00007fffe4041cd8 in rel_column_exp (sql=0x1554758, rel=0x7fffe3359870, column_e=0x170dae8, f=3) at ../../../src/server/
14 0x00007fffe4042f82 in rel_select_exp (sql=0x1554758, rel=0xb2abc8, outer=0x0, sn=0x170dd88, ek=...) at ../../../src/server/
15 0x00007fffe4043ccb in rel_query (sql=0x1554758, rel=0x0, sq=0x170dd88, toplevel=1, ek=...) at ../../../src/server/
16 0x00007fffe404514a in rel_subquery (sql=0x1554758, rel=0x0, sq=0x170dd88, ek=...) at ../../../src/server/
17 0x00007fffe4045d53 in insert_into (sql=0x1554758, qname=0x170cf68, columns=0x0, val_or_q=0x170dd88) at ../../../src/server/
18 0x00007fffe40481c3 in rel_updates (sql=0x1554758, s=0x170deb8) at ../../../src/server/
19 0x00007fffe4032c5c in rel_semantic (sql=0x1554758, s=0x170deb8) at ../../../src/server/
20 0x00007fffe3f97a48 in sql_symbol2stmt (c=0x1554758, sym=0x170deb8) at ../../../../src/backends/monet5/
21 0x00007fffe3fe3d2f in SQLparser (c=0x605898) at ../../../../src/backends/monet5/
22 0x00007ffff7b05516 in runPhase (c=0x605898, phase=1) at ../../../src/mal/
23 0x00007ffff7b0564e in runScenarioBody (c=0x605898) at ../../../src/mal/
24 0x00007ffff7b058d5 in runScenario (c=0x605898) at ../../../src/mal/
25 0x00007ffff7ab864a in MSserveClient (dummy=0x605898) at ../../../src/mal/
26 0x00007ffff579fc0a in start_thread () from /lib64/
27 0x00007ffff48a7a9d in clone () from /lib64/

Something seems to go wrong with the concept that I want to use a 'value' from another table inside a function.

Reproducible: Always

MonetDB server v5.22.2 (64-bit), based on kernel v1.40.2 (64-bit oids)
Not released
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved
Visit for further information
Found 3.9GiB available memory, 2 available cpu cores
Configured for prefix: /opt/monetdb-testing3
libpcre: 8.02 2010-03-19 (compiled with 8.02)
openssl: OpenSSL 1.0.0a 1 Jun 2010 (compiled with OpenSSL 1.0.0a 1 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 15283

Date: 2010-12-05 12:13:07 +0100
From: @njnes

this bug indicates a number of problems. Most important one is that we don't handle table functions with multi row input. Currently it doesn't fit the relations trees we built internally. Requires some more work.

Other problems are that we don't test for this case and because of that crash (trigger an assert).

Comment 16043

Date: 2011-07-29 11:00:07 +0200
From: @sjoerdmullender

Apr2011-SP2 has been released.

Comment 16207

Date: 2011-09-11 22:02:33 +0200
From: @njnes

now supported through union functions. This is still work in progress and extends beyond normal sql standard.

Comment 16208

Date: 2011-09-12 09:45:59 +0200
From: @sjoerdmullender

This will not appear in the Aug2011 release.

Comment 16833

Date: 2012-01-26 15:32:07 +0100
From: @sjoerdmullender

The Dec2011 version has been release, so declaring this bug as FIXED.

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

Successfully merging a pull request may close this issue.

None yet
1 participant