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

Assertion failed: (bn->batCapacity >= cnt), function BAT_scanselect, file gdk_select.c, line 1008. #3784

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


Copy link

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

Date: 2015-08-11 12:14:22 +0200
From: @hannesmuehleisen
To: SQL devs <>
Version: 11.19.3 (Oct2014)

Last updated: 2015-08-28 13:43:11 +0200

Comment 21115

Date: 2015-08-11 12:14:22 +0200
From: @hannesmuehleisen

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36
Build Identifier:

When running the following query, an assertion fails and kills mserver

SELECT t.rcl,SUM(ct) as t,SUM(cr) as r,SUM(ce) as tel, COUNT(*) as r1 FROM (select ct,cr,ce, case when ct = 0 then 0 when ct BETWEEN 1 AND 10000 then 1 when ct BETWEEN 10000 AND 50000 then 2 when ct BETWEEN 50000 AND 100000 then 3 when ct BETWEEN 100000 AND 200000 then 4 when ct BETWEEN 200000 AND 300000 then 5 when ct BETWEEN 300000 AND 500000 then 6 when ct BETWEEN 500000 AND 1000000 then 7 when ct BETWEEN 1000000 AND 2000000 then 8 when ct BETWEEN 2000000 AND 5000000 then 9 when ct BETWEEN 5000000 AND 10000000 then 10 when ct > 10000000 then 11 else 12 end as rcl from (SELECT reservedCid,ct,cr,ce FROM (SELECT jt.column1 as reservedCid,SUM(ri.column1) as ct,COUNT( as cr,SUM(ri.el) as ce FROM Table3 as jt, (SELECT column3 as el, * FROM Table1) as ri WHERE (ri .column2 = 'R') AND jt.column2 = group by jt.column1) AS agg, Table2 AS contract WHERE agg.reservedCid = as ft) as t GROUP BY t.rcl ORDER BY t.rcl;

Reproducible: Always

Steps to Reproduce:

  1. import from
  2. run query above
  3. crash

Actual Results:


Expected Results:

Some result or an error message

Here is a stack trace

 frame 4: 0x000000010040259a libbat.12.dylib`BAT_scanselect(b=0x00000001051531d0, s=0x00000001051582e0, bn=0x0000000105172f20, tl=0x000000010419b570, th=0x000000010419b570, li=1, hi=1, equi=1, anti=0, lval=1, hval=1, maximum=358031, use_imprints=0) + 9002 at gdk_select.c:1008
 frame 5: 0x00000001003fd54b libbat.12.dylib`BATsubselect(b=0x00000001051531d0, s=0x00000001051582e0, tl=0x000000010419b570, th=0x000000010419b570, li=1, hi=1, anti=0) + 36267 at gdk_select.c:1704
 frame 6: 0x00000001000ec549 libmonetdb5.19.dylib`ALGsubselect2(result=0x0000000101092970, bid=0x0000000101092250, sid=0x00000001010921d0, low=0x000000010419b570, high=0x000000010419b570, li=0x0000000101090350, hi=0x0000000101090650, anti=0x0000000101090650) + 841 at algebra.c:341

Comment 21117

Date: 2015-08-11 15:11:41 +0200
From: @sjoerdmullender

I couldn't initially reproduce this problem, but if I set the number of threads to 4, I could.

Comment 21119

Date: 2015-08-11 15:41:36 +0200
From: MonetDB Mercurial Repository <>

Changeset fff94a9041d2 made by Sjoerd Mullender in the MonetDB repo, refers to this bug.

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

Changeset description:

Off-by-one error.
p is incremented before the number of remaining items is calculated, a
calculation that involves p.  Compensate for the early increment.
This fixes bug #3784.

Comment 21234

Date: 2015-08-28 13:43:11 +0200
From: @sjoerdmullender

Jul2015 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