Some charts in a dashboard show "There was a problem displaying this chart"

I open a dashboard with many heavy-query charts, and some charts show "There was a problem displaying this chart". It always happens when I refresh dashboard.

I use Metabase 0.44.6, use Postgres 14 as metabase database, nginx as reverse proxy and Redshift as warehouse. I don't set timeout for Redshift query, nginx timeout is set about 10 mins. Some charts shows errors in just 1-3 minutes, so I think may be Metabase cancels some charts' query itself.

Here's my diagnostic info:

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.16.1+1",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.16.1",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.16.1+1",
    "os.name": "Linux",
    "os.version": "5.15.0-1023-aws",
    "user.language": "en",
    "user.timezone": "Asia/Ho_Chi_Minh"
  },
  "metabase-info": {
    "databases": [
      "redshift"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "14.5 (Debian 14.5-2.pgdg110+2)"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.5.0"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2022-11-01",
      "tag": "v0.44.6",
      "branch": "release-x.44.x",
      "hash": "5c6ae21"
    },
    "settings": {
      "report-timezone": "Etc/UTC"
    }
  }
}

Here's the troubleshooting logs:

[ad6afe31-21d3-4a4c-9caa-c076586a632b] 2022-12-01T11:40:31+07:00 ERROR metabase.query-processor.middleware.catch-exceptions Error processing query: ERROR: Query (398864101) cancelled on user's request
  Detail: 
{:database_id 3,
 :started_at #t "2022-12-01T11:39:26.702888+07:00[Asia/Ho_Chi_Minh]",
 :via
 [{:status :failed,
   :class clojure.lang.ExceptionInfo,
   :error "Error executing query: ERROR: Query (398864101) cancelled on user's request\n  Detail: ",
   :stacktrace
   ["--> driver.sql_jdbc.execute$execute_reducible_query$fn__55246.invoke(execute.clj:502)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:499)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:494)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
    "driver.sql_jdbc$fn__86209.invokeStatic(sql_jdbc.clj:54)"
    "driver.sql_jdbc$fn__86209.invoke(sql_jdbc.clj:52)"
    "query_processor.context$executef.invokeStatic(context.clj:59)"
    "query_processor.context$executef.invoke(context.clj:48)"
    "query_processor.context.default$default_runf.invokeStatic(default.clj:67)"
    "query_processor.context.default$default_runf.invoke(default.clj:65)"
    "query_processor.context$runf.invokeStatic(context.clj:45)"
    "query_processor.context$runf.invoke(context.clj:39)"
    "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:12)"
    "query_processor.reducible$identity_qp.invoke(reducible.clj:9)"
    "query_processor.middleware.cache$run_query_with_cache.invokeStatic(cache.clj:193)"
    "query_processor.middleware.cache$run_query_with_cache.invoke(cache.clj:178)"
    "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___52623.invoke(cache.clj:219)"
    "query_processor.middleware.permissions$check_query_permissions$fn__48144.invoke(permissions.clj:109)"
    "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__51568.invoke(mbql_to_native.clj:23)"
    "query_processor$fn__54099$combined_post_process__54104$combined_post_process_STAR___54105.invoke(query_processor.clj:212)"
    "query_processor$fn__54099$combined_pre_process__54100$combined_pre_process_STAR___54101.invoke(query_processor.clj:209)"
    "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544$fn__52549.invoke(resolve_database_and_driver.clj:35)"
    "driver$do_with_driver.invokeStatic(driver.clj:75)"
    "driver$do_with_driver.invoke(driver.clj:71)"
    "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544.invoke(resolve_database_and_driver.clj:34)"
    "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__48579.invoke(fetch_source_query.clj:353)"
    "query_processor.middleware.store$initialize_store$fn__48767$fn__48768.invoke(store.clj:11)"
    "query_processor.store$do_with_store.invokeStatic(store.clj:44)"
    "query_processor.store$do_with_store.invoke(store.clj:38)"
    "query_processor.middleware.store$initialize_store$fn__48767.invoke(store.clj:10)"
    "query_processor.middleware.normalize_query$normalize$fn__52816.invoke(normalize_query.clj:22)"
    "query_processor.middleware.constraints$add_default_userland_constraints$fn__49849.invoke(constraints.clj:53)"
    "query_processor.middleware.process_userland_query$process_userland_query$fn__52755.invoke(process_userland_query.clj:145)"
    "query_processor.middleware.catch_exceptions$catch_exceptions$fn__53127.invoke(catch_exceptions.clj:167)"
    "query_processor.reducible$async_qp$qp_STAR___44982$thunk__44984.invoke(reducible.clj:100)"
    "query_processor.reducible$async_qp$qp_STAR___44982$fn__44986.invoke(reducible.clj:105)"],
   :error_type :invalid-query,
   :ex-data
   {:sql
    "-- /* partner: \"metabase\", {\"dashboard_id\":null,\"chart_id\":57,\"optional_user_id\":8,\"optional_account_id\":\"099648ca-63b8-4c2d-9831-be849cd49cd8\",\"filter_values\":{}} */ Metabase:: userID: 8 queryType: native queryHash: 7a7501a8e93ceefc2340da7cd142193183f724a5b7aebb0f9914eb7c69e5e783\nwith no_fos as(\nselect distinct\nt0.root_id,\nfrom_date,\ndate_trunc('month',t0.from_date) as from_date_edited,\nto_date,\ncase when t0.to_date is not null then last_day(t0.to_date - 12) else t0.to_date end as to_date_edited\nfrom public.a_retailer_segments t0\nwhere 1=1\nand experiment_id like 'hn_no_fos'\n-- and coalesce(to_date,current_date) >= current_date\n)\n\n\n,promo_amount as (\nwith rule_condition as(\nselect\ndistinct\nr0.ruleid as rule_id\n,r0.ruletype\n,r0.rulestatus\n,r0.ruleactionsreference_actiontype as rule_type\n,r0.rulename\n,r0.ruledescription\n,r0.fromdate\n,r0.todate\nfrom mongodb.phnx_promo_rule_master r0\nwhere 1=1\nand rulestatus not in ('REJECTED','PENDING')\n)\n\nselect\ndistinct\nt0.order_id,\nt5.date_of_order,\nt5.so_number,\nt5.root_id,\nt6.from_date,\nt6.to_date,\ncase when t6.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nt0.rule_id,\nr0.rulename,\nt0.discount\nfrom\n  (\n  select order_id, rule_id,customer_id, applied_at,updated_at,order_cancelled,promotion_active,discount, channel\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  -- and entity_applied_on = 'SKU'\n  ) t0\ninner join\n  (\n  select order_id, rule_id, max(updated_at) as final_updated_at\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  and cart_id is not null\n  -- and promotion_active = 'f'\n  group by order_id, rule_id) t1\non 1=1\nand t0.order_id = t1.order_id\nand t0.rule_id = t1.rule_id\nand t0.updated_at = t1.final_updated_at\n\ninner join\n  (\n  select distinct sales_order_id, SPLIT_PART(a.applied_rule_ids,',', b.rnb::INT) as rule_id\n  from phnx_orders.sales_order_additional_info a\n  inner join\n    (\n    select row_number() over () as rnb\n    from core.d_sku_management limit 100) b\n  on REGEXP_COUNT(a.applied_rule_ids, ',') + 1 >= b.rnb\n  where 1=1\n  and created_at::date >= '2021-07-01'\n  )  t2\non t0.order_id = t2.sales_order_id\nand t0.rule_id = t2.rule_id\ninner join (select distinct sequence_id as so_number, id as order_id from phnx_orders.sales_order) t4\non t0.order_id = t4.order_id\ninner join (select distinct date_of_order, so_number, root_id, customer_id,original_status,city from core.f_retailer_transaction_detail) t5\non t4.so_number = t5.so_number\nleft join no_fos t6\non t5.root_id = t6.root_id\ninner join rule_condition r0\non t0.rule_id = r0.rule_id\nwhere 1=1\nand t5.date_of_order >= dateadd('month',-3,date_trunc('month',current_date-2))\nand t5.date_of_order <= CURRENT_DATE - 2\nand t5.original_status in ('DELIVERED','PARTIAL_DELIVERED','COMPLETED')\n-- and t6.root_id is null\n)\n\n,promotion_nofos as(\nselect\ndate_of_order,\nsum(case when rulename like '%Giảm 0.4%: ưu đãi trực tuyến%' or rulename like '%0.5%%' or rulename like 'Ưu đãi độc quyền: Giảm thêm 0.3%'\n        and from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as nofos_exclusive_discount,\nsum(case when from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as promo_amount,\npromo_amount - nofos_exclusive_discount as other_promo_discount\nfrom promo_amount\nwhere 1=1\nand customer_type = 'No FOS'\ngroup by 1)\n\n,raw_data_nofos as(\nselect\nt1.date_of_order,\nt2.promo_amount,\nt2.nofos_exclusive_discount,\nt2.other_promo_discount,\nt1.del_gmv\nfrom (\nselect\ndate_of_order,\ncase when t3.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nsum((sku_qty_ordered-sku_qty_refunded)*selling_price)*0.000043 as del_gmv\nfrom core.f_retailer_transaction_detail t2\ninner join no_fos t3\non 1=1\nand t2.root_id = t3.root_id\nand t3.from_date <= t2.date_of_order\nand coalesce(t3.to_date,current_date) > t2.date_of_order\nwhere 1=1\nand t2.date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\n-- and t2.date_of_order <= CURRENT_DATE - 2\nand t2.original_status in ('COMPLETED', 'DELIVERED', 'PARTIAL_DELIVERED')\ngroup by 1,2) t1\nleft join promotion_nofos t2\non t1.date_of_order = t2.date_of_order\n)\n\nselect\nperiod,\ntotal_nofos_exclusive_discount,\ntotal_other_promo_discount,\ntotal_nofos_exclusive_discount*1.0/total_del_gmv as total_nofos_exclusive_pct,\ntotal_other_promo_discount*1.0/total_del_gmv as total_other_promo_discount_pct\nfrom\n(select\ncase when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-2,current_date)) then '1. M-2'\n    when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-1,current_date)) then '2. M-1'\n    when date_trunc('month',date_of_order) = date_trunc('month',current_date) then '3. M0'\n    end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\ngroup by 1\n\nunion all\n\nselect\ncase when date_of_order between CURRENT_DATE - 7 and CURRENT_DATE - 1 then\n'5. Last 7d' else '4. Prev 7d' end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order between CURRENT_DATE - 14 and CURRENT_DATE - 1\ngroup by 1)\norder by period",
    :params nil,
    :type :invalid-query}}],
 :state "57014",
 :error_type :invalid-query,
 :json_query
 {:constraints {:max-results 10000, :max-results-bare-rows 2000},
  :type :native,
  :middleware {:js-int-to-string? true, :ignore-cached-results? false},
  :native
  {:query
   "with no_fos as(\nselect distinct\nt0.root_id,\nfrom_date,\ndate_trunc('month',t0.from_date) as from_date_edited,\nto_date,\ncase when t0.to_date is not null then last_day(t0.to_date - 12) else t0.to_date end as to_date_edited\nfrom public.a_retailer_segments t0\nwhere 1=1\nand experiment_id like 'hn_no_fos'\n-- and coalesce(to_date,current_date) >= current_date\n)\n\n\n,promo_amount as (\nwith rule_condition as(\nselect\ndistinct\nr0.ruleid as rule_id\n,r0.ruletype\n,r0.rulestatus\n,r0.ruleactionsreference_actiontype as rule_type\n,r0.rulename\n,r0.ruledescription\n,r0.fromdate\n,r0.todate\nfrom mongodb.phnx_promo_rule_master r0\nwhere 1=1\nand rulestatus not in ('REJECTED','PENDING')\n)\n\nselect\ndistinct\nt0.order_id,\nt5.date_of_order,\nt5.so_number,\nt5.root_id,\nt6.from_date,\nt6.to_date,\ncase when t6.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nt0.rule_id,\nr0.rulename,\nt0.discount\nfrom\n  (\n  select order_id, rule_id,customer_id, applied_at,updated_at,order_cancelled,promotion_active,discount, channel\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  -- and entity_applied_on = 'SKU'\n  ) t0\ninner join\n  (\n  select order_id, rule_id, max(updated_at) as final_updated_at\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  and cart_id is not null\n  -- and promotion_active = 'f'\n  group by order_id, rule_id) t1\non 1=1\nand t0.order_id = t1.order_id\nand t0.rule_id = t1.rule_id\nand t0.updated_at = t1.final_updated_at\n\ninner join\n  (\n  select distinct sales_order_id, SPLIT_PART(a.applied_rule_ids,',', b.rnb::INT) as rule_id\n  from phnx_orders.sales_order_additional_info a\n  inner join\n    (\n    select row_number() over () as rnb\n    from core.d_sku_management limit 100) b\n  on REGEXP_COUNT(a.applied_rule_ids, ',') + 1 >= b.rnb\n  where 1=1\n  and created_at::date >= '2021-07-01'\n  )  t2\non t0.order_id = t2.sales_order_id\nand t0.rule_id = t2.rule_id\ninner join (select distinct sequence_id as so_number, id as order_id from phnx_orders.sales_order) t4\non t0.order_id = t4.order_id\ninner join (select distinct date_of_order, so_number, root_id, customer_id,original_status,city from core.f_retailer_transaction_detail) t5\non t4.so_number = t5.so_number\nleft join no_fos t6\non t5.root_id = t6.root_id\ninner join rule_condition r0\non t0.rule_id = r0.rule_id\nwhere 1=1\nand t5.date_of_order >= dateadd('month',-3,date_trunc('month',current_date-2))\nand t5.date_of_order <= CURRENT_DATE - 2\nand t5.original_status in ('DELIVERED','PARTIAL_DELIVERED','COMPLETED')\n-- and t6.root_id is null\n)\n\n,promotion_nofos as(\nselect\ndate_of_order,\nsum(case when rulename like '%Giảm 0.4%: ưu đãi trực tuyến%' or rulename like '%0.5%%' or rulename like 'Ưu đãi độc quyền: Giảm thêm 0.3%'\n        and from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as nofos_exclusive_discount,\nsum(case when from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as promo_amount,\npromo_amount - nofos_exclusive_discount as other_promo_discount\nfrom promo_amount\nwhere 1=1\nand customer_type = 'No FOS'\ngroup by 1)\n\n,raw_data_nofos as(\nselect\nt1.date_of_order,\nt2.promo_amount,\nt2.nofos_exclusive_discount,\nt2.other_promo_discount,\nt1.del_gmv\nfrom (\nselect\ndate_of_order,\ncase when t3.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nsum((sku_qty_ordered-sku_qty_refunded)*selling_price)*0.000043 as del_gmv\nfrom core.f_retailer_transaction_detail t2\ninner join no_fos t3\non 1=1\nand t2.root_id = t3.root_id\nand t3.from_date <= t2.date_of_order\nand coalesce(t3.to_date,current_date) > t2.date_of_order\nwhere 1=1\nand t2.date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\n-- and t2.date_of_order <= CURRENT_DATE - 2\nand t2.original_status in ('COMPLETED', 'DELIVERED', 'PARTIAL_DELIVERED')\ngroup by 1,2) t1\nleft join promotion_nofos t2\non t1.date_of_order = t2.date_of_order\n)\n\nselect\nperiod,\ntotal_nofos_exclusive_discount,\ntotal_other_promo_discount,\ntotal_nofos_exclusive_discount*1.0/total_del_gmv as total_nofos_exclusive_pct,\ntotal_other_promo_discount*1.0/total_del_gmv as total_other_promo_discount_pct\nfrom\n(select\ncase when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-2,current_date)) then '1. M-2'\n    when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-1,current_date)) then '2. M-1'\n    when date_trunc('month',date_of_order) = date_trunc('month',current_date) then '3. M0'\n    end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\ngroup by 1\n\nunion all\n\nselect\ncase when date_of_order between CURRENT_DATE - 7 and CURRENT_DATE - 1 then\n'5. Last 7d' else '4. Prev 7d' end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order between CURRENT_DATE - 14 and CURRENT_DATE - 1\ngroup by 1)\norder by period",
   :template-tags {}},
  :database 3,
  :parameters [],
  :async? true,
  :cache-ttl 567},
 :status :failed,
 :class com.amazon.redshift.util.RedshiftException,
 :stacktrace
 ["com.amazon.redshift.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2601)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResultsOnThread(QueryExecutorImpl.java:2269)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1880)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1872)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeInternal(RedshiftStatementImpl.java:514)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.execute(RedshiftStatementImpl.java:435)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:376)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeCachedSql(RedshiftStatementImpl.java:362)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:339)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.execute(RedshiftStatementImpl.java:329)"
  "com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)"
  "--> driver.sql_jdbc.execute$fn__55166.invokeStatic(execute.clj:367)"
  "driver.sql_jdbc.execute$fn__55166.invoke(execute.clj:365)"
  "driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invokeStatic(execute.clj:375)"
  "driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invoke(execute.clj:372)"
  "driver.sql_jdbc.execute$execute_reducible_query$fn__55246.invoke(execute.clj:500)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:499)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:494)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc$fn__86209.invokeStatic(sql_jdbc.clj:54)"
  "driver.sql_jdbc$fn__86209.invoke(sql_jdbc.clj:52)"
  "query_processor.context$executef.invokeStatic(context.clj:59)"
  "query_processor.context$executef.invoke(context.clj:48)"
  "query_processor.context.default$default_runf.invokeStatic(default.clj:67)"
  "query_processor.context.default$default_runf.invoke(default.clj:65)"
  "query_processor.context$runf.invokeStatic(context.clj:45)"
  "query_processor.context$runf.invoke(context.clj:39)"
  "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:12)"
  "query_processor.reducible$identity_qp.invoke(reducible.clj:9)"
  "query_processor.middleware.cache$run_query_with_cache.invokeStatic(cache.clj:193)"
  "query_processor.middleware.cache$run_query_with_cache.invoke(cache.clj:178)"
  "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___52623.invoke(cache.clj:219)"
  "query_processor.middleware.permissions$check_query_permissions$fn__48144.invoke(permissions.clj:109)"
  "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__51568.invoke(mbql_to_native.clj:23)"
  "query_processor$fn__54099$combined_post_process__54104$combined_post_process_STAR___54105.invoke(query_processor.clj:212)"
  "query_processor$fn__54099$combined_pre_process__54100$combined_pre_process_STAR___54101.invoke(query_processor.clj:209)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544$fn__52549.invoke(resolve_database_and_driver.clj:35)"
  "driver$do_with_driver.invokeStatic(driver.clj:75)"
  "driver$do_with_driver.invoke(driver.clj:71)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544.invoke(resolve_database_and_driver.clj:34)"
  "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__48579.invoke(fetch_source_query.clj:353)"
  "query_processor.middleware.store$initialize_store$fn__48767$fn__48768.invoke(store.clj:11)"
  "query_processor.store$do_with_store.invokeStatic(store.clj:44)"
  "query_processor.store$do_with_store.invoke(store.clj:38)"
  "query_processor.middleware.store$initialize_store$fn__48767.invoke(store.clj:10)"
  "query_processor.middleware.normalize_query$normalize$fn__52816.invoke(normalize_query.clj:22)"
  "query_processor.middleware.constraints$add_default_userland_constraints$fn__49849.invoke(constraints.clj:53)"
  "query_processor.middleware.process_userland_query$process_userland_query$fn__52755.invoke(process_userland_query.clj:145)"
  "query_processor.middleware.catch_exceptions$catch_exceptions$fn__53127.invoke(catch_exceptions.clj:167)"
  "query_processor.reducible$async_qp$qp_STAR___44982$thunk__44984.invoke(reducible.clj:100)"
  "query_processor.reducible$async_qp$qp_STAR___44982$fn__44986.invoke(reducible.clj:105)"],
 :card_id 57,
 :context :dashboard,
 :error "ERROR: Query (398864101) cancelled on user's request\n  Detail: ",
 :row_count 0,
 :running_time 0,
 :data {:rows [], :cols []}}

[ad6afe31-21d3-4a4c-9caa-c076586a632b] 2022-12-01T11:40:31+07:00 ERROR metabase.query-processor.middleware.catch-exceptions Error processing query: ERROR: Query (398864055) cancelled on user's request
  Detail: 
{:database_id 3,
 :started_at #t "2022-12-01T11:39:26.619192+07:00[Asia/Ho_Chi_Minh]",
 :via
 [{:status :failed,
   :class clojure.lang.ExceptionInfo,
   :error "Error executing query: ERROR: Query (398864055) cancelled on user's request\n  Detail: ",
   :stacktrace
   ["--> driver.sql_jdbc.execute$execute_reducible_query$fn__55246.invoke(execute.clj:502)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:499)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
    "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:494)"
    "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
    "driver.sql_jdbc$fn__86209.invokeStatic(sql_jdbc.clj:54)"
    "driver.sql_jdbc$fn__86209.invoke(sql_jdbc.clj:52)"
    "query_processor.context$executef.invokeStatic(context.clj:59)"
    "query_processor.context$executef.invoke(context.clj:48)"
    "query_processor.context.default$default_runf.invokeStatic(default.clj:67)"
    "query_processor.context.default$default_runf.invoke(default.clj:65)"
    "query_processor.context$runf.invokeStatic(context.clj:45)"
    "query_processor.context$runf.invoke(context.clj:39)"
    "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:12)"
    "query_processor.reducible$identity_qp.invoke(reducible.clj:9)"
    "query_processor.middleware.cache$run_query_with_cache.invokeStatic(cache.clj:193)"
    "query_processor.middleware.cache$run_query_with_cache.invoke(cache.clj:178)"
    "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___52623.invoke(cache.clj:219)"
    "query_processor.middleware.permissions$check_query_permissions$fn__48144.invoke(permissions.clj:109)"
    "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__51568.invoke(mbql_to_native.clj:23)"
    "query_processor$fn__54099$combined_post_process__54104$combined_post_process_STAR___54105.invoke(query_processor.clj:212)"
    "query_processor$fn__54099$combined_pre_process__54100$combined_pre_process_STAR___54101.invoke(query_processor.clj:209)"
    "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544$fn__52549.invoke(resolve_database_and_driver.clj:35)"
    "driver$do_with_driver.invokeStatic(driver.clj:75)"
    "driver$do_with_driver.invoke(driver.clj:71)"
    "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544.invoke(resolve_database_and_driver.clj:34)"
    "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__48579.invoke(fetch_source_query.clj:353)"
    "query_processor.middleware.store$initialize_store$fn__48767$fn__48768.invoke(store.clj:11)"
    "query_processor.store$do_with_store.invokeStatic(store.clj:44)"
    "query_processor.store$do_with_store.invoke(store.clj:38)"
    "query_processor.middleware.store$initialize_store$fn__48767.invoke(store.clj:10)"
    "query_processor.middleware.normalize_query$normalize$fn__52816.invoke(normalize_query.clj:22)"
    "query_processor.middleware.constraints$add_default_userland_constraints$fn__49849.invoke(constraints.clj:53)"
    "query_processor.middleware.process_userland_query$process_userland_query$fn__52755.invoke(process_userland_query.clj:145)"
    "query_processor.middleware.catch_exceptions$catch_exceptions$fn__53127.invoke(catch_exceptions.clj:167)"
    "query_processor.reducible$async_qp$qp_STAR___44982$thunk__44984.invoke(reducible.clj:100)"
    "query_processor.reducible$async_qp$qp_STAR___44982$fn__44986.invoke(reducible.clj:105)"],
   :error_type :invalid-query,
   :ex-data
   {:sql
    "-- /* partner: \"metabase\", {\"dashboard_id\":null,\"chart_id\":58,\"optional_user_id\":8,\"optional_account_id\":\"099648ca-63b8-4c2d-9831-be849cd49cd8\",\"filter_values\":{}} */ Metabase:: userID: 8 queryType: native queryHash: 13c5bd17d03bff842ef598be48b5d185c23b160250485c04b58c350b2965dd38\nwith no_fos as(\nselect distinct\nt0.root_id,\nfrom_date,\ndate_trunc('month',t0.from_date) as from_date_edited,\nto_date,\ncase when t0.to_date is not null then last_day(t0.to_date - 12) else t0.to_date end as to_date_edited\nfrom public.a_retailer_segments t0\nwhere 1=1\nand experiment_id like 'hn_no_fos'\n-- and coalesce(to_date,current_date) >= current_date\n)\n\n\n,promo_amount as (\nwith rule_condition as(\nselect\ndistinct\nr0.ruleid as rule_id\n,r0.ruletype\n,r0.rulestatus\n,r0.ruleactionsreference_actiontype as rule_type\n,r0.rulename\n,r0.ruledescription\n,r0.fromdate\n,r0.todate\nfrom mongodb.phnx_promo_rule_master r0\nwhere 1=1\nand rulestatus not in ('REJECTED','PENDING')\n)\n\nselect\ndistinct\nt0.order_id,\nt5.date_of_order,\nt5.so_number,\nt5.root_id,\nt6.from_date,\nt6.to_date,\ncase when t6.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nt0.rule_id,\nr0.rulename,\nt0.discount\nfrom\n  (\n  select order_id, rule_id,customer_id, applied_at,updated_at,order_cancelled,promotion_active,discount, channel\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  -- and entity_applied_on = 'SKU'\n  ) t0\ninner join\n  (\n  select order_id, rule_id, max(updated_at) as final_updated_at\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  and cart_id is not null\n  -- and promotion_active = 'f'\n  group by order_id, rule_id) t1\non 1=1\nand t0.order_id = t1.order_id\nand t0.rule_id = t1.rule_id\nand t0.updated_at = t1.final_updated_at\n\ninner join\n  (\n  select distinct sales_order_id, SPLIT_PART(a.applied_rule_ids,',', b.rnb::INT) as rule_id\n  from phnx_orders.sales_order_additional_info a\n  inner join\n    (\n    select row_number() over () as rnb\n    from core.d_sku_management limit 100) b\n  on REGEXP_COUNT(a.applied_rule_ids, ',') + 1 >= b.rnb\n  where 1=1\n  and created_at::date >= '2021-07-01'\n  )  t2\non t0.order_id = t2.sales_order_id\nand t0.rule_id = t2.rule_id\ninner join (select distinct sequence_id as so_number, id as order_id from phnx_orders.sales_order) t4\non t0.order_id = t4.order_id\ninner join (select distinct date_of_order, so_number, root_id, customer_id,original_status,city from core.f_retailer_transaction_detail) t5\non t4.so_number = t5.so_number\nleft join no_fos t6\non t5.root_id = t6.root_id\ninner join rule_condition r0\non t0.rule_id = r0.rule_id\nwhere 1=1\nand t5.date_of_order >= dateadd('month',-3,date_trunc('month',current_date-2))\nand t5.date_of_order <= CURRENT_DATE - 2\nand t5.original_status in ('DELIVERED','PARTIAL_DELIVERED','COMPLETED')\n-- and t6.root_id is null\n)\n\n,promotion_nofos as(\nselect\ndate_of_order,\nsum(case when rulename like '%Giảm 0.4%: ưu đãi trực tuyến%' or rulename like '%0.5%%' or rulename like 'Ưu đãi độc quyền: Giảm thêm 0.3%'\n        and from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as nofos_exclusive_discount,\nsum(case when from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as promo_amount,\npromo_amount - nofos_exclusive_discount as other_promo_discount\nfrom promo_amount\nwhere 1=1\nand customer_type = 'No FOS'\ngroup by 1)\n\n,raw_data_nofos as(\nselect\nt1.date_of_order,\nt2.promo_amount,\nt2.nofos_exclusive_discount,\nt2.other_promo_discount,\nt1.del_gmv\nfrom (\nselect\ndate_of_order,\ncase when t3.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nsum((sku_qty_ordered-sku_qty_refunded)*selling_price)*0.000043 as del_gmv\nfrom core.f_retailer_transaction_detail t2\ninner join no_fos t3\non 1=1\nand t2.root_id = t3.root_id\nand t3.from_date <= t2.date_of_order\nand coalesce(t3.to_date,current_date) > t2.date_of_order\nwhere 1=1\nand t2.date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\n-- and t2.date_of_order <= CURRENT_DATE - 2\nand t2.original_status in ('COMPLETED', 'DELIVERED', 'PARTIAL_DELIVERED')\ngroup by 1,2) t1\nleft join promotion_nofos t2\non t1.date_of_order = t2.date_of_order\n)\n\nselect\nperiod,\ntotal_nofos_exclusive_discount,\ntotal_other_promo_discount,\ntotal_nofos_exclusive_discount*1.0/total_del_gmv as total_nofos_exclusive_pct,\ntotal_other_promo_discount*1.0/total_del_gmv as total_other_promo_discount_pct\nfrom\n(select\ncase when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-2,current_date)) then '1. M-2'\n    when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-1,current_date)) then '2. M-1'\n    when date_trunc('month',date_of_order) = date_trunc('month',current_date) then '3. M0'\n    end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\ngroup by 1\n\nunion all\n\nselect\ncase when date_of_order between CURRENT_DATE - 7 and CURRENT_DATE - 1 then\n'5. Last 7d' else '4. Prev 7d' end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order between CURRENT_DATE - 14 and CURRENT_DATE - 1\ngroup by 1)\norder by period",
    :params nil,
    :type :invalid-query}}],
 :state "57014",
 :error_type :invalid-query,
 :json_query
 {:constraints {:max-results 10000, :max-results-bare-rows 2000},
  :type :native,
  :middleware {:js-int-to-string? true, :ignore-cached-results? false},
  :native
  {:query
   "with no_fos as(\nselect distinct\nt0.root_id,\nfrom_date,\ndate_trunc('month',t0.from_date) as from_date_edited,\nto_date,\ncase when t0.to_date is not null then last_day(t0.to_date - 12) else t0.to_date end as to_date_edited\nfrom public.a_retailer_segments t0\nwhere 1=1\nand experiment_id like 'hn_no_fos'\n-- and coalesce(to_date,current_date) >= current_date\n)\n\n\n,promo_amount as (\nwith rule_condition as(\nselect\ndistinct\nr0.ruleid as rule_id\n,r0.ruletype\n,r0.rulestatus\n,r0.ruleactionsreference_actiontype as rule_type\n,r0.rulename\n,r0.ruledescription\n,r0.fromdate\n,r0.todate\nfrom mongodb.phnx_promo_rule_master r0\nwhere 1=1\nand rulestatus not in ('REJECTED','PENDING')\n)\n\nselect\ndistinct\nt0.order_id,\nt5.date_of_order,\nt5.so_number,\nt5.root_id,\nt6.from_date,\nt6.to_date,\ncase when t6.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nt0.rule_id,\nr0.rulename,\nt0.discount\nfrom\n  (\n  select order_id, rule_id,customer_id, applied_at,updated_at,order_cancelled,promotion_active,discount, channel\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  -- and entity_applied_on = 'SKU'\n  ) t0\ninner join\n  (\n  select order_id, rule_id, max(updated_at) as final_updated_at\n  from phnx_promo.promotion_audit_flat\n  where 1=1\n  and applied_at::date >= dateadd('month',-3,date_trunc('month',current_date-2))\n  and cart_id is not null\n  -- and promotion_active = 'f'\n  group by order_id, rule_id) t1\non 1=1\nand t0.order_id = t1.order_id\nand t0.rule_id = t1.rule_id\nand t0.updated_at = t1.final_updated_at\n\ninner join\n  (\n  select distinct sales_order_id, SPLIT_PART(a.applied_rule_ids,',', b.rnb::INT) as rule_id\n  from phnx_orders.sales_order_additional_info a\n  inner join\n    (\n    select row_number() over () as rnb\n    from core.d_sku_management limit 100) b\n  on REGEXP_COUNT(a.applied_rule_ids, ',') + 1 >= b.rnb\n  where 1=1\n  and created_at::date >= '2021-07-01'\n  )  t2\non t0.order_id = t2.sales_order_id\nand t0.rule_id = t2.rule_id\ninner join (select distinct sequence_id as so_number, id as order_id from phnx_orders.sales_order) t4\non t0.order_id = t4.order_id\ninner join (select distinct date_of_order, so_number, root_id, customer_id,original_status,city from core.f_retailer_transaction_detail) t5\non t4.so_number = t5.so_number\nleft join no_fos t6\non t5.root_id = t6.root_id\ninner join rule_condition r0\non t0.rule_id = r0.rule_id\nwhere 1=1\nand t5.date_of_order >= dateadd('month',-3,date_trunc('month',current_date-2))\nand t5.date_of_order <= CURRENT_DATE - 2\nand t5.original_status in ('DELIVERED','PARTIAL_DELIVERED','COMPLETED')\n-- and t6.root_id is null\n)\n\n,promotion_nofos as(\nselect\ndate_of_order,\nsum(case when rulename like '%Giảm 0.4%: ưu đãi trực tuyến%' or rulename like '%0.5%%' or rulename like 'Ưu đãi độc quyền: Giảm thêm 0.3%'\n        and from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as nofos_exclusive_discount,\nsum(case when from_date <= date_of_order and coalesce(to_date,current_date) > date_of_order\n        then discount end)*0.000043 as promo_amount,\npromo_amount - nofos_exclusive_discount as other_promo_discount\nfrom promo_amount\nwhere 1=1\nand customer_type = 'No FOS'\ngroup by 1)\n\n,raw_data_nofos as(\nselect\nt1.date_of_order,\nt2.promo_amount,\nt2.nofos_exclusive_discount,\nt2.other_promo_discount,\nt1.del_gmv\nfrom (\nselect\ndate_of_order,\ncase when t3.root_id is not null then 'No FOS' else 'FOS' end as customer_type,\nsum((sku_qty_ordered-sku_qty_refunded)*selling_price)*0.000043 as del_gmv\nfrom core.f_retailer_transaction_detail t2\ninner join no_fos t3\non 1=1\nand t2.root_id = t3.root_id\nand t3.from_date <= t2.date_of_order\nand coalesce(t3.to_date,current_date) > t2.date_of_order\nwhere 1=1\nand t2.date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\n-- and t2.date_of_order <= CURRENT_DATE - 2\nand t2.original_status in ('COMPLETED', 'DELIVERED', 'PARTIAL_DELIVERED')\ngroup by 1,2) t1\nleft join promotion_nofos t2\non t1.date_of_order = t2.date_of_order\n)\n\nselect\nperiod,\ntotal_nofos_exclusive_discount,\ntotal_other_promo_discount,\ntotal_nofos_exclusive_discount*1.0/total_del_gmv as total_nofos_exclusive_pct,\ntotal_other_promo_discount*1.0/total_del_gmv as total_other_promo_discount_pct\nfrom\n(select\ncase when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-2,current_date)) then '1. M-2'\n    when date_trunc('month',date_of_order) = date_trunc('month',dateadd('month',-1,current_date)) then '2. M-1'\n    when date_trunc('month',date_of_order) = date_trunc('month',current_date) then '3. M0'\n    end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order >= dateadd('month',-2,date_trunc('month',current_date-2))\ngroup by 1\n\nunion all\n\nselect\ncase when date_of_order between CURRENT_DATE - 7 and CURRENT_DATE - 1 then\n'5. Last 7d' else '4. Prev 7d' end as period,\nsum(promo_amount)::float as total_promo_amount,\nsum(other_promo_discount)::float as total_other_promo_discount,\nsum(nofos_exclusive_discount)::Float as total_nofos_exclusive_discount,\nsum(del_gmv)::float as total_del_gmv\nfrom raw_data_nofos\nwhere 1=1\nand date_of_order between CURRENT_DATE - 14 and CURRENT_DATE - 1\ngroup by 1)\norder by period\n",
   :template-tags {}},
  :database 3,
  :parameters [],
  :async? true,
  :cache-ttl 575},
 :status :failed,
 :class com.amazon.redshift.util.RedshiftException,
 :stacktrace
 ["com.amazon.redshift.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2601)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResultsOnThread(QueryExecutorImpl.java:2269)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1880)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1872)"
  "com.amazon.redshift.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeInternal(RedshiftStatementImpl.java:514)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.execute(RedshiftStatementImpl.java:435)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:376)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeCachedSql(RedshiftStatementImpl.java:362)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.executeWithFlags(RedshiftStatementImpl.java:339)"
  "com.amazon.redshift.jdbc.RedshiftStatementImpl.execute(RedshiftStatementImpl.java:329)"
  "com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)"
  "--> driver.sql_jdbc.execute$fn__55166.invokeStatic(execute.clj:367)"
  "driver.sql_jdbc.execute$fn__55166.invoke(execute.clj:365)"
  "driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invokeStatic(execute.clj:375)"
  "driver.sql_jdbc.execute$execute_statement_or_prepared_statement_BANG_.invoke(execute.clj:372)"
  "driver.sql_jdbc.execute$execute_reducible_query$fn__55246.invoke(execute.clj:500)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:499)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:494)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc$fn__86209.invokeStatic(sql_jdbc.clj:54)"
  "driver.sql_jdbc$fn__86209.invoke(sql_jdbc.clj:52)"
  "query_processor.context$executef.invokeStatic(context.clj:59)"
  "query_processor.context$executef.invoke(context.clj:48)"
  "query_processor.context.default$default_runf.invokeStatic(default.clj:67)"
  "query_processor.context.default$default_runf.invoke(default.clj:65)"
  "query_processor.context$runf.invokeStatic(context.clj:45)"
  "query_processor.context$runf.invoke(context.clj:39)"
  "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:12)"
  "query_processor.reducible$identity_qp.invoke(reducible.clj:9)"
  "query_processor.middleware.cache$run_query_with_cache.invokeStatic(cache.clj:193)"
  "query_processor.middleware.cache$run_query_with_cache.invoke(cache.clj:178)"
  "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___52623.invoke(cache.clj:219)"
  "query_processor.middleware.permissions$check_query_permissions$fn__48144.invoke(permissions.clj:109)"
  "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__51568.invoke(mbql_to_native.clj:23)"
  "query_processor$fn__54099$combined_post_process__54104$combined_post_process_STAR___54105.invoke(query_processor.clj:212)"
  "query_processor$fn__54099$combined_pre_process__54100$combined_pre_process_STAR___54101.invoke(query_processor.clj:209)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544$fn__52549.invoke(resolve_database_and_driver.clj:35)"
  "driver$do_with_driver.invokeStatic(driver.clj:75)"
  "driver$do_with_driver.invoke(driver.clj:71)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__52544.invoke(resolve_database_and_driver.clj:34)"
  "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__48579.invoke(fetch_source_query.clj:353)"
  "query_processor.middleware.store$initialize_store$fn__48767$fn__48768.invoke(store.clj:11)"
  "query_processor.store$do_with_store.invokeStatic(store.clj:44)"
  "query_processor.store$do_with_store.invoke(store.clj:38)"
  "query_processor.middleware.store$initialize_store$fn__48767.invoke(store.clj:10)"
  "query_processor.middleware.normalize_query$normalize$fn__52816.invoke(normalize_query.clj:22)"
  "query_processor.middleware.constraints$add_default_userland_constraints$fn__49849.invoke(constraints.clj:53)"
  "query_processor.middleware.process_userland_query$process_userland_query$fn__52755.invoke(process_userland_query.clj:145)"
  "query_processor.middleware.catch_exceptions$catch_exceptions$fn__53127.invoke(catch_exceptions.clj:167)"
  "query_processor.reducible$async_qp$qp_STAR___44982$thunk__44984.invoke(reducible.clj:100)"
  "query_processor.reducible$async_qp$qp_STAR___44982$fn__44986.invoke(reducible.clj:105)"],
 :card_id 58,
 :context :dashboard,
 :error "ERROR: Query (398864055) cancelled on user's request\n  Detail: ",
 :row_count 0,
 :running_time 0,
 :data {:rows [], :cols []}}

I found the reason. I use Elastic Load Balancing for metabase webserver domain, and it's default idle timeout connection is 60 seconds. I increased it to 600 seconds, and it works.