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 in MalOptimizer #6938

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

Segmentation fault in MalOptimizer #6938

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working major MAL/M5

Comments

@monetdb-team
Copy link

Date: 2020-07-28 16:45:15 +0200
From: Jaya Krishna <>
To: MonetDB5 devs <>
Version: 11.37.7 (Jun2020)
CC: @PedroTadim

Last updated: 2020-10-19 11:06:19 +0200

Comment 27948

Date: 2020-07-28 16:45:15 +0200
From: Jaya Krishna <>

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Build Identifier:

Trying to explain/execute a specific query on TPCH-x data. It crashes mserver5 every time. Following is the stack trace from the core dump.

Storage: /var/lib/systemd/coredump/core.mserver5.974.996f490adbde4b37ade65737779bd504.20803.1595946389000000.lz4
Message: Process 20803 (mserver5) of user 974 dumped core.

             Stack trace of thread 20820:
             0  0x00007fee21d83a4e optimizeMALBlock (libmonetdb5.so.29)
             1  0x00007fee1b76a63f SQLrun (lib_sql.so)
             2  0x00007fee1b76ba56 SQLengineIntern (lib_sql.so)
             3  0x00007fee21cd3c26 runPhase (libmonetdb5.so.29)
             4  0x00007fee21cd410a MSserveClient (libmonetdb5.so.29)
             5  0x00007fee21cd46b1 MSscheduleClient (libmonetdb5.so.29)
             6  0x00007fee21d3316b doChallenge (libmonetdb5.so.29)
             7  0x00007fee219b717f THRstarter (libbat.so.20)
             8  0x00007fee219e4edd thread_starter (libbat.so.20)
             9  0x00007fee1f1002de start_thread (libpthread.so.0)
             10 0x00007fee1ee30a63 __clone (libc.so.6)

             Stack trace of thread 20806:
             0  0x00007fee1ee257e1 __poll (libc.so.6)
             1  0x00007fee21d34963 poll (libmonetdb5.so.29)
             2  0x00007fee219e4edd thread_starter (libbat.so.20)
             3  0x00007fee1f1002de start_thread (libpthread.so.0)
             4  0x00007fee1ee30a63 __clone (libc.so.6)

             Stack trace of thread 20818:
             0  0x00007fee1f10a210 __nanosleep (libpthread.so.0)
             1  0x00007fee219e4c92 MT_sleep_ms (libbat.so.20)
             2  0x00007fee1b88f664 store_manager (lib_sql.so)
             3  0x00007fee219b717f THRstarter (libbat.so.20)
             4  0x00007fee219e4edd thread_starter (libbat.so.20)
             5  0x00007fee1f1002de start_thread (libpthread.so.0)
             6  0x00007fee1ee30a63 __clone (libc.so.6)

             Stack trace of thread 20821:
             0  0x00007fee1ee257e1 __poll (libc.so.6)
             1  0x00007fee212df369 socket_read (libstream.so.13)
             2  0x00007fee212e1317 mnstr_readSht (libstream.so.13)
             3  0x00007fee212e14f5 bs_read (libstream.so.13)

Reproducible: Always

Steps to Reproduce:

1.Explain or execute the following query on TPCH-1 data. The TPCH scale does not matter.

SET SCHEMA tpchperf;
explain SELECT
DM_CustomerNation_N_NAME AS CustomerNation,
DM_CustomerRegion_R_NAME AS CustomerRegion,
avg(DM_Li_L_DISCOUNT) AS L_DISCOUNT_Customer_Nation_Supplier_Nation,
sum(DM_Li_L_QUANTITY) AS L_QUANTITY_Customer_Nation_Supplier_Nation,
O_ORDERDATE_Year,
DM_Nation_N_NAME AS SupplierNation,
DM_Region_R_NAME AS SupplierRegion
FROM
tpchperf.CUSTOMER
INNER JOIN
(
SELECT
DM_Li_L_DISCOUNT,
DM_Li_L_ORDERKEY,DM_Li_L_PARTKEY,
DM_Li_L_QUANTITY,
DM_Nation_N_NAME,
DM_Nation_N_NATIONKEY,DM_Nation_N_REGIONKEY,
DM_Orders_O_CUSTKEY,DM_Orders_O_ORDERDATE,
DM_Orders_O_ORDERKEY,
DM_Partsupp_PS_PARTKEY,
DM_Partsupp_PS_SUPPKEY,
DM_Region_R_NAME,
DM_Region_R_REGIONKEY,
S_NATIONKEY AS DM_Supplier_S_NATIONKEY,
S_SUPPKEY AS DM_Supplier_S_SUPPKEY,O_ORDERDATE_Year
FROM
tpchperf.SUPPLIER
INNER JOIN
(
SELECT
DM_Li_L_DISCOUNT,
DM_Li_L_ORDERKEY,DM_Li_L_PARTKEY,
DM_Li_L_QUANTITY,
PS_PARTKEY AS DM_Partsupp_PS_PARTKEY,PS_SUPPKEY AS DM_Partsupp_PS_SUPPKEY
FROM
tpchperf.PARTSUPP
INNER JOIN
(
SELECT
L_DISCOUNT AS DM_Li_L_DISCOUNT,
L_ORDERKEY AS DM_Li_L_ORDERKEY,
L_PARTKEY AS DM_Li_L_PARTKEY,
L_QUANTITY AS DM_Li_L_QUANTITY,
L_SUPPKEY AS DM_Li_L_SUPPKEY
FROM
tpchperf.LINEITEM
) AS LINEITEM
ON PS_SUPPKEY = DM_Li_L_SUPPKEY
AND PS_PARTKEY = DM_Li_L_PARTKEY
)
AS LINEITEMPARTSUPP
ON S_SUPPKEY = DM_Partsupp_PS_SUPPKEY
INNER JOIN
(
SELECT
N_NAME AS DM_Nation_N_NAME,
N_NATIONKEY AS DM_Nation_N_NATIONKEY,
N_REGIONKEY AS DM_Nation_N_REGIONKEY
FROM
tpchperf.NATION
)
AS NATION
ON S_NATIONKEY = DM_Nation_N_NATIONKEY
INNER JOIN
(
SELECT
R_NAME AS DM_Region_R_NAME,
R_REGIONKEY AS DM_Region_R_REGIONKEY
FROM
tpchperf.REGION
)
AS REGION
ON DM_Nation_N_REGIONKEY = DM_Region_R_REGIONKEY
INNER JOIN
(
SELECT
O_CUSTKEY AS DM_Orders_O_CUSTKEY,
O_ORDERDATE AS DM_Orders_O_ORDERDATE,
O_ORDERKEY AS DM_Orders_O_ORDERKEY,
O_TOTALPRICE AS DM_Orders_O_TOTALPRICE,
Extract(YEAR FROM O_ORDERDATE) AS O_ORDERDATE_Year
FROM
tpchperf.ORDERS
)
AS ORDERS
ON DM_Li_L_ORDERKEY = DM_Orders_O_ORDERKEY
)
AS CUSTOMERORDERDETAILS
ON C_CUSTKEY = DM_Orders_O_CUSTKEY
INNER JOIN
(
SELECT
N_NAME AS DM_CustomerNation_N_NAME,
N_NATIONKEY AS DM_CustomerNation_N_NATIONKEY,
N_REGIONKEY AS DM_CustomerNation_N_REGIONKEY
FROM
tpchperf.NATION
)
AS NATION
ON C_NATIONKEY = DM_CustomerNation_N_NATIONKEY
INNER JOIN
(
SELECT
R_NAME AS DM_CustomerRegion_R_NAME,
R_REGIONKEY AS DM_CustomerRegion_R_REGIONKEY
FROM
tpchperf.REGION
)
AS REGION
ON DM_CustomerNation_N_REGIONKEY = DM_CustomerRegion_R_REGIONKEY
WHERE
O_ORDERDATE_Year >= 1996
AND DM_CustomerRegion_R_NAME IN
(
'EUROPE',
'AMERICA'
)
AND DM_Region_R_NAME IN
(
'EUROPE',
'AMERICA'
)
GROUP BY CUBE(O_ORDERDATE_Year, CustomerRegion, CustomerNation, SupplierRegion, SupplierNation)

  1. It crashes the mserver5 process. Interestingly if we just remove the 'CUBE' grouping at the end and make it a plain Group by, it works. Not sure what is happening. This is not related to the data because simple EXPLAIN of query crashes the server.

Actual Results:

mserver5 crashes.

Expected Results:

Results retrieved with the listed aggregations, sub-totals and totals as per the grouping set. Forget the results, the system should not crash.

Pretty high end CENTOS Server on VCLOUD. However resources do not matter as simple EXPLAIN is resulting in crash.

Comment 27949

Date: 2020-07-28 20:18:04 +0200
From: @PedroTadim

I missed the propagation of aliases on grouping columns. It's already fixed and will be available at the next release. Thanks for the report.

Comment 27951

Date: 2020-07-29 05:27:57 +0200
From: Jaya Krishna <>

Thanks for the prompt response. Pleasantly surprised and appreciate it.

regards
Jaya Krishna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major MAL/M5
Projects
None yet
Development

No branches or pull requests

2 participants