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

strLength assertion on join and concat #3311

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

strLength assertion on join and concat #3311

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

Comments

@monetdb-team
Copy link

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

Date: 2013-06-20 11:13:44 +0200
From: @swingbit
To: SQL devs <>
Version: 11.15.3 (Feb2013-SP1)
CC: @mlkersten, @njnes

Last updated: 2013-09-27 13:47:16 +0200

Comment 18866

Date: 2013-06-20 11:13:44 +0200
From: @swingbit

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

I could not really pinpoint the exact cause for this bug, however I have a reproducible test and a few remarks.

The query triggering the bug:

SELECT x.idstr, '{ "pid":"'||x.idstr||'" }' as json
FROM y, x
WHERE y.subject=x.id;

The assertion: src/monetdb5/modules/atoms/str.c:1357: strLength: Assertion `l <2147483647' failed.

gdb sais:
Thread 10 (Thread 0x7f99a5a5d700 (LWP 1209)):
0 0x0000003d8dc35ba5 in raise () from /lib64/libc.so.6
1 0x0000003d8dc37358 in abort () from /lib64/libc.so.6
2 0x0000003d8dc2e972 in __assert_fail_base () from /lib64/libc.so.6
3 0x0000003d8dc2ea22 in __assert_fail () from /lib64/libc.so.6
4 0x00007f99c0058743 in strLength (res=0x7f99a5a5c430, s=0x7f998418a7f0 "{ "pid":"\310\064" }") at /opt/spinque/MonetDBServer/MonetDB.Spinque_Feb2013/src/monetdb5/modules/atoms/str.c:1357
5 0x00007f99b77ea23f in bat_max_strlength (b=0x7f9984003e50) at /opt/spinque/MonetDBServer/MonetDB.Spinque_Feb2013/src/sql/backends/monet5/sql_result.c:219
6 0x00007f99b77ef6a4 in export_length (s=0x7f99a0004b00, mtype=12, eclass=4, digits=0, scale=0, tz=0, bid=4194, p=0x0) at /opt/spinque/MonetDBServer/MonetDB.Spinque_Feb2013/src/sql/backends/monet5/sql_result.c:1189
7 0x00007f99b77f06ba in mvc_export_head (m=0x7f9998005470, s=0x7f99a0004b00, res_id=2, only_header=1) at /opt/spinque/MonetDBServer/MonetDB.Spinque_Feb2013/src/sql/backends/monet5/sql_result.c:1477
8 0x00007f99b77f0aff in mvc_export_result (m=0x7f9998005470, s=0x7f99a0004b00, res_id=2) at /opt/spinque/MonetDBServer/MonetDB.Spinque_Feb2013/src/sql/backends/monet5/sql_result.c:1546
...

Note that:

  • The string "pid":"\310\064", for which strLength fails, DOES NOT exist in the data. It must be the wrong outcome of previous intermediate results.
  • removing the join with y, it works
  • removing the concatenation bit, it works
  • removing the first column from the target list, it works
  • disabling mitosis, it works
  • with less data, it works

Reproducible: Always

Actual Results:

/src/monetdb5/modules/atoms/str.c:1357: strLength: Assertion `l <2147483647' failed.

changeset: 47997:918b41d7564d
branch: Feb2013
parent: 47995:223fee7295a2
user: Hannes Muehleisen hannes@cwi.nl
date: Wed Jun 19 15:23:34 2013 +0200
summary: Post release build.

$ mserver5 --version
MonetDB 5 server v11.15.10 (64-bit, 64-bit oids)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved
Visit http://www.monetdb.org/ for further information
Found 15.6GiB available memory, 8 available cpu cores
Libraries:
libpcre: 8.31 2012-07-06 (compiled with 8.31)
openssl: OpenSSL 1.0.1e 11 Feb 2013 (compiled with OpenSSL 1.0.1e-fips 11 Feb 2013)
libxml2: 2.9.1 (compiled with 2.9.1)
Compiled by: roberto@photon.spinque.com (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/bin/ld -m elf_x86_64

Comment 18867

Date: 2013-06-20 11:16:21 +0200
From: @swingbit

I cannot make the test with real data public. I can send the file if you ask me by email.

Comment 18869

Date: 2013-06-20 11:41:41 +0200
From: @mlkersten

Could you run it with valgrind? It seems there might be an issue much earlier in the process.

Comment 18875

Date: 2013-06-22 15:46:53 +0200
From: @njnes

Fixed. This was a very interesting bug. The problem was caused by a concurrent mat pack which triggered a BATappend, which again called string_insert_bat.
That string_insert_bat has a nice optimization for the case when we don't eliminate duplicates anymore, ie its simply copies the var-heap.
This is all fine, but the bun (offset) copying was done by disabling
the varsized atom marker. Which caused the concurrent string concat function to see the offset as strings.

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