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

Segfault on large chain of constant decimal multiplication #7003

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

Segfault on large chain of constant decimal multiplication #7003

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2020-10-28 22:42:14 +0100
From: @Mytherin
To: SQL devs <>
Version: 11.39.5 (Oct2020)
CC: martin.van.dinther, @PedroTadim, @yzchang

Last updated: 2020-11-24 11:37:24 +0100

Comment 28230

Date: 2020-10-28 22:42:14 +0100
From: @Mytherin

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15
Build Identifier:

The following query results in a segmentation fault in mserver:

select 0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*0.1;

The same query, but with the multiplication replaced by addition, does return the correct result:

select 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1;

Reproducible: Always

Comment 28231

Date: 2020-10-28 22:44:36 +0100
From: @Mytherin

To add, the query succeeds if we include an explicit cast to double on the first constant:

select cast(0.1 as double)0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1
0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*
0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*
0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*
0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1;

Comment 28234

Date: 2020-10-29 09:16:18 +0100
From: @yzchang

It doesn't crash with changeset 4d973ec7aa13

sql>select
more>0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*0.1;
+------------------------------------------+
| %2 |
+==========================================+
| 0.00000000000000000000000000000000000001 |
+------------------------------------------+

Maybe it's fixed after the release?

Comment 28235

Date: 2020-10-29 09:25:04 +0100
From: @PedroTadim

While running SQLancer, I found there was an issue on the output scales for large numbers (it caused an assertion error). On the Oct2020 release commit I get wrong results. Meanwhile this got fixed and it will be available on the SP1 release soon.

Comment 28276

Date: 2020-11-18 18:18:47 +0100
From: Martin van Dinther <<martin.van.dinther>>

The output for query:
select 0.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.1*0.1;
is still incorrect. It returns 0.000000000000000001
it should return decimal 0.0 or double 1.0e-86.
Tested with MonetDB v11.39.7 (Oct2020-SP1).

Also a test for this issue is missing in sql/test/BugTracker-2020/Tests/.

Comment 28277

Date: 2020-11-18 18:37:23 +0100
From: @PedroTadim

We truncate the number because we run out of digits, I think this acceptable and the bug can be closed. It's not explicit if the output has to be a decimal or a floating-point.

Comment 28278

Date: 2020-11-19 15:02:31 +0100
From: MonetDB Mercurial Repository <>

Changeset eb7b7c474646 made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=eb7b7c474646

Changeset description:

Add test and output for bug #7003
@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants