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: sql_mem.c:48: sql_ref_dec: Assertion `r->refcnt > 0' failed. #3582

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


Copy link

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

Date: 2014-09-20 17:56:25 +0200
From: @skinkie
To: SQL devs <>
Version: 11.17.21 (Jan2014-SP3)
CC: @njnes

Last updated: 2014-10-31 14:14:36 +0100

Comment 20174

Date: 2014-09-20 17:56:25 +0200
From: @skinkie

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.68 Safari/537.36
Build Identifier:

I was using double quotes, instead of single quotes and ended up with the following.

Reproducible: Always

Steps to Reproduce:

CREATE TABLE "sys"."kv6" (
"receive" TIMESTAMP,
"message" TIMESTAMP,
"vehicle" TIMESTAMP,
"messagetype" VARCHAR(10),
"operatingday" DATE,
"dataownercode" VARCHAR(10),
"lineplanningnumber" VARCHAR(10),
"journeynumber" INTEGER,
"reinforcementnumber" INTEGER,
"userstopcode" VARCHAR(10),
"passagesequencenumber" INTEGER,
"distancesincelastuserstop" INTEGER,
"punctuality" INTEGER,
"rd_x" INTEGER,
"rd_y" INTEGER,
"blockcode" INTEGER,
"vehiclenumber" INTEGER,
"wheelchairaccessible" VARCHAR(5),
"source" VARCHAR(10),
"numberofcoaches" INTEGER,
"trip_hash" BIGINT

select distinct "sum("||lineplanningnumber||") as l"||lineplanningnumber||", " from "sys"."kv6" order by cast(lineplanningnumber as int);

mserver5: sql_mem.c:48: sql_ref_dec: Assertion `r->refcnt > 0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff17cc700 (LWP 11583)]
0x00007ffff4aac535 in raise () from /lib64/
(gdb) bt
0 0x00007ffff4aac535 in raise () from /lib64/
1 0x00007ffff4aad9b8 in abort () from /lib64/
2 0x00007ffff4aa55f2 in ?? () from /lib64/
3 0x00007ffff4aa56a2 in __assert_fail () from /lib64/
4 0x00007ffff2ee01ba in sql_ref_dec (r=0x7fffe40b8540) at sql_mem.c:48
5 0x00007ffff2e426bd in rel_destroy (rel=0x7fffe40b8540) at rel_select.c:72
6 0x00007ffff2e52411 in _rel_aggr (sql=0x7fffe4005450, rel=0x7ffff17cb658, distinct=0, s=0x7fffe4008290, aname=0x7fffe40b7c80 "concat", args=0x7fffe40b7cf0, f=2) at rel_select.c:3849
7 0x00007ffff2e52fda in rel_aggr (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7d30, f=2) at rel_select.c:3981
8 0x00007ffff2e5181f in rel_binop (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7d30, f=2, ek=...) at rel_select.c:3697
9 0x00007ffff2e55f1e in rel_value_exp2 (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7d30, f=2, ek=..., is_last=0x7ffff17cb41c) at rel_select.c:4710
10 0x00007ffff2e56a32 in rel_value_exp (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7d30, f=2, ek=...) at rel_select.c:4865
11 0x00007ffff2e517b4 in rel_binop (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7ea0, f=2, ek=...) at rel_select.c:3691
12 0x00007ffff2e55f1e in rel_value_exp2 (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7ea0, f=2, ek=..., is_last=0x7ffff17cb5ec) at rel_select.c:4710
13 0x00007ffff2e56a32 in rel_value_exp (sql=0x7fffe4005450, rel=0x7ffff17cb658, se=0x7fffe40b7ea0, f=2, ek=...) at rel_select.c:4865
14 0x00007ffff2e52829 in _rel_aggr (sql=0x7fffe4005450, rel=0x7ffff17cbad0, distinct=0, s=0x7fffe4008290, aname=0x7fffe40b7f50 "concat", args=0x7fffe40b7fc0, f=2) at rel_select.c:3887
15 0x00007ffff2e52fda in rel_aggr (sql=0x7fffe4005450, rel=0x7ffff17cbad0, se=0x7fffe40b8000, f=2) at rel_select.c:3981
16 0x00007ffff2e5181f in rel_binop (sql=0x7fffe4005450, rel=0x7ffff17cbad0, se=0x7fffe40b8000, f=2, ek=...) at rel_select.c:3697
17 0x00007ffff2e55f1e in rel_value_exp2 (sql=0x7fffe4005450, rel=0x7ffff17cbad0, se=0x7fffe40b8000, f=2, ek=..., is_last=0x7ffff17cb9dc) at rel_select.c:4710
18 0x00007ffff2e56a32 in rel_value_exp (sql=0x7fffe4005450, rel=0x7ffff17cbad0, se=0x7fffe40b8000, f=2, ek=...) at rel_select.c:4865
19 0x00007ffff2e56b17 in column_exp (sql=0x7fffe4005450, rel=0x7ffff17cbad0, column_e=0x7fffe40b8080, f=2) at rel_select.c:4878
20 0x00007ffff2e56d7a in rel_column_exp (sql=0x7fffe4005450, rel=0x7ffff17cbad0, column_e=0x7fffe40b8080, f=2) at rel_select.c:4922
21 0x00007ffff2e57919 in rel_select_exp (sql=0x7fffe4005450, rel=0x7fffe40b92b0, sn=0x7fffe40b82e0, ek=...) at rel_select.c:5115
22 0x00007ffff2e5864e in rel_query (sql=0x7fffe4005450, rel=0x0, sq=0x7fffe40b82e0, toplevel=1, ek=..., apply=8) at rel_select.c:5320
23 0x00007ffff2e59fc9 in rel_subquery (sql=0x7fffe4005450, rel=0x0, sq=0x7fffe40b82e0, ek=..., apply=8) at rel_select.c:5699
24 0x00007ffff2e5a0a1 in rel_selects (sql=0x7fffe4005450, s=0x7fffe40b82e0) at rel_select.c:5716
25 0x00007ffff2e42465 in rel_semantic (sql=0x7fffe4005450, s=0x7fffe40b82e0) at rel_semantic.c:264
26 0x00007ffff2d7b088 in sql_symbol2relation (c=0x7fffe4005450, sym=0x7fffe40b82e0) at sql.c:125
27 0x00007ffff2d9dcef in SQLparser (c=0x647330) at sql_scenario.c:2104
28 0x00007ffff78fd7c6 in runPhase (c=0x647330, phase=1) at mal_scenario.c:526
29 0x00007ffff78fd968 in runScenarioBody (c=0x647330) at mal_scenario.c:561
30 0x00007ffff78fdb22 in runScenario (c=0x647330) at mal_scenario.c:590
31 0x00007ffff78ff4c8 in MSserveClient (dummy=0x647330) at mal_session.c:459
32 0x00007ffff739c910 in thread_starter (arg=0x7fffec000a20) at gdk_system.c:506
33 0x00007ffff4e27f3a in start_thread () from /lib64/
34 0x00007ffff4b61dad in clone () from /lib64/

4 0x00007ffff2ee01ba in sql_ref_dec (r=0x7fffe40b8540) at sql_mem.c:48
48 assert(r->refcnt > 0);
(gdb) list
43 }
45 int
46 sql_ref_dec(sql_ref *r)
47 {
48 assert(r->refcnt > 0);
49 return (--r->refcnt);
50 }
(gdb) up
5 0x00007ffff2e426bd in rel_destroy (rel=0x7fffe40b8540) at rel_select.c:72
72 if (sql_ref_dec(&rel->ref) > 0)
(gdb) list
67 void
68 rel_destroy(sql_rel *rel)
69 {
70 if (!rel)
71 return;
72 if (sql_ref_dec(&rel->ref) > 0)
73 return;
74 rel_destroy_(rel);
75 }

MonetDB 5 server v11.19.0 (64-bit, 64-bit oids)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
Visit for further information
Found 31.4GiB available memory, 8 available cpu cores
libpcre: 8.33 2013-05-28 (compiled with 8.33)
openssl: OpenSSL 1.0.1h 5 Jun 2014 (compiled with OpenSSL 1.0.1h 5 Jun 2014)
libxml2: 2.9.1 (compiled with 2.9.1)
Compiled by: (x86_64-unknown-linux-gnu)
Compilation: gcc -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code
Linking : /usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64

Comment 20181

Date: 2014-09-21 17:40:32 +0200
From: @njnes

fixed cleanup

Comment 20182

Date: 2014-09-21 17:41:10 +0200
From: MonetDB Mercurial Repository <>

Changeset 229116aeddb0 made by Niels Nes in the MonetDB repo, refers to this bug.

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

Changeset description:

fixed bug #3582

Comment 20381

Date: 2014-10-31 14:14:36 +0100
From: @sjoerdmullender

Oct2014 has been released.

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