Skip to content

[Bug]: TPC-DS 1TB Q4 returns context canceled instead of the HashBuild failure #26745

Closed

Description

@Ariznawlll

Description

TPC-DS 1 TB query4 fails on current MatrixOne main. The server first records the real HashBuild memory-budget exhaustion, but the SQL client only receives internal error: context canceled. The original product error is lost during pipeline cancellation/cleanup, making the failure misleading and hard to diagnose.

Environment

Steps to reproduce

Load TPC-DS SF=1000 and execute the exact generated SQL:

with year_total as (
 select c_customer_id customer_id
       ,c_first_name customer_first_name
       ,c_last_name customer_last_name
       ,c_preferred_cust_flag customer_preferred_cust_flag
       ,c_birth_country customer_birth_country
       ,c_login customer_login
       ,c_email_address customer_email_address
       ,d_year dyear
       ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total
       ,'s' sale_type
 from customer
     ,store_sales
     ,date_dim
 where c_customer_sk = ss_customer_sk
   and ss_sold_date_sk = d_date_sk
 group by c_customer_id
         ,c_first_name
         ,c_last_name
         ,c_preferred_cust_flag
         ,c_birth_country
         ,c_login
         ,c_email_address
         ,d_year
 union all
 select c_customer_id customer_id
       ,c_first_name customer_first_name
       ,c_last_name customer_last_name
       ,c_preferred_cust_flag customer_preferred_cust_flag
       ,c_birth_country customer_birth_country
       ,c_login customer_login
       ,c_email_address customer_email_address
       ,d_year dyear
       ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total
       ,'c' sale_type
 from customer
     ,catalog_sales
     ,date_dim
 where c_customer_sk = cs_bill_customer_sk
   and cs_sold_date_sk = d_date_sk
 group by c_customer_id
         ,c_first_name
         ,c_last_name
         ,c_preferred_cust_flag
         ,c_birth_country
         ,c_login
         ,c_email_address
         ,d_year
union all
 select c_customer_id customer_id
       ,c_first_name customer_first_name
       ,c_last_name customer_last_name
       ,c_preferred_cust_flag customer_preferred_cust_flag
       ,c_birth_country customer_birth_country
       ,c_login customer_login
       ,c_email_address customer_email_address
       ,d_year dyear
       ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total
       ,'w' sale_type
 from customer
     ,web_sales
     ,date_dim
 where c_customer_sk = ws_bill_customer_sk
   and ws_sold_date_sk = d_date_sk
 group by c_customer_id
         ,c_first_name
         ,c_last_name
         ,c_preferred_cust_flag
         ,c_birth_country
         ,c_login
         ,c_email_address
         ,d_year
         )
select * from (  select
                  t_s_secyear.customer_id
                 ,t_s_secyear.customer_first_name
                 ,t_s_secyear.customer_last_name
                 ,t_s_secyear.customer_email_address
 from year_total t_s_firstyear
     ,year_total t_s_secyear
     ,year_total t_c_firstyear
     ,year_total t_c_secyear
     ,year_total t_w_firstyear
     ,year_total t_w_secyear
 where t_s_secyear.customer_id = t_s_firstyear.customer_id
   and t_s_firstyear.customer_id = t_c_secyear.customer_id
   and t_s_firstyear.customer_id = t_c_firstyear.customer_id
   and t_s_firstyear.customer_id = t_w_firstyear.customer_id
   and t_s_firstyear.customer_id = t_w_secyear.customer_id
   and t_s_firstyear.sale_type = 's'
   and t_c_firstyear.sale_type = 'c'
   and t_w_firstyear.sale_type = 'w'
   and t_s_secyear.sale_type = 's'
   and t_c_secyear.sale_type = 'c'
   and t_w_secyear.sale_type = 'w'
   and t_s_firstyear.dyear =  2001
   and t_s_secyear.dyear = 2001+1
   and t_c_firstyear.dyear =  2001
   and t_c_secyear.dyear =  2001+1
   and t_w_firstyear.dyear = 2001
   and t_w_secyear.dyear = 2001+1
   and t_s_firstyear.year_total > 0
   and t_c_firstyear.year_total > 0
   and t_w_firstyear.year_total > 0
   and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end
           > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end
   and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end
           > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end
 order by t_s_secyear.customer_id
         ,t_s_secyear.customer_first_name
         ,t_s_secyear.customer_last_name
         ,t_s_secyear.customer_email_address
 ) where rownum <= 100;

Actual behavior

The query failed after 44.407 seconds. The client received only:

ERROR 20101 (HY000) at line 1: internal error: context canceled

However, the server sequence shows the initiating failure before the client error:

  1. pipeline MPool reached 41877357976 bytes (39.001 GiB);
  2. global MPool reached 55854839680 bytes (52.019 GiB);
  3. out of memory records began;
  4. an operator diagnostic reported:
    resource exhausted: hash build memory budget exceeded
    requested=10240 used=42949663808 limit=42949672960
    
  5. cleanup/cancellation produced 122 internal error: context canceled records;
  6. the client received only the cancellation error.

Expected behavior

The client must receive the original actionable HashBuild resource-exhausted error. Pipeline cancellation and cleanup must not replace an already-known execution failure with generic context canceled.

The underlying HashBuild budget/spill failure is tracked separately in #26742; this issue specifically tracks error propagation and preservation.

Stability and controls

  • Reproducer: observed in one official full TPC-DS SF=1000 run; no manual rerun before filing.
  • Control: query64 in the same run returned its HashBuild error directly rather than only context canceled.
  • Failure state: MatrixOne stayed alive and later queries continued.

Evidence

  • Actions run/job linked above.
  • Exact generated SQL and query4.err are in the run's tpcds-result artifact.
  • Loki logs for host 10-222-1-129 contain the ordered resource-exhausted and context-canceled records.

Code analysis

The first failure is HashBuild budget exhaustion, but the pipeline's cancellation/cleanup path loses or overrides the durable original error before the client response. This is an error-precedence/propagation bug separate from whether HashBuild should have spilled successfully.

Regression coverage

Add a focused regression where HashBuild returns a known resource-exhausted error while downstream pipeline operators are active. Assert that the client receives the original error and that cleanup completes without replacing it with context canceled.

Related

Activity

  1. added this to the MO-202608 milestone on Aug 6, 2026
  2. added
    kind/bug
    on Aug 6, 2026
  3. added theissue type on Aug 6, 2026
  4. self-assigned this
    on Aug 6, 2026
  5. added
    severity/s0
    and removed on Aug 6, 2026
  6. self-assigned this
    on Aug 7, 2026
  7. removed their assignment
    on Aug 10, 2026
  8. added a commit that references this issue on Aug 12, 2026
    fe62a8f
  9. added 3 commits that reference this issue on Sep 17, 2026
    1c65af0
    e888cf6
    947f906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions