After upgrade xlsx file shows an exception as contents

Hello!

We have query that runs fine, takes ~1 minute to run, but when we try to download results in xlsx format it takes 20 minutes running (always) and then give us a xlsx file with the following exception:

Thanks for any insight you have.

{
  "via": [
    {
      "type": "clojure.lang.ExceptionInfo",
      "message": "O tempo limite expirou após 20.0 mins.",
      "data": {
        "status": "timed-out",
        "type": "timed-out"
      },
      "at": [
        "metabase.query_processor.context.default$default_timeoutf",
        "invokeStatic",
        "default.clj",
        91
      ]
    }
  ],
  "trace": [
    [
      "metabase.query_processor.context.default$default_timeoutf",
      "invokeStatic",
      "default.clj",
      91
    ],
    [
      "metabase.query_processor.context.default$default_timeoutf",
      "invoke",
      "default.clj",
      87
    ],
    [
      "metabase.query_processor.context$timeoutf",
      "invokeStatic",
      "context.clj",
      98
    ],
    [
      "metabase.query_processor.context$timeoutf",
      "invoke",
      "context.clj",
      93
    ],
    [
      "metabase.query_processor.reducible$wire_up_context_channels_BANG_$fn__36445$state_machine__15974__auto____36454$fn__36456",
      "invoke",
      "reducible.clj",
      24
    ],
    [
      "metabase.query_processor.reducible$wire_up_context_channels_BANG_$fn__36445$state_machine__15974__auto____36454",
      "invoke",
      "reducible.clj",
      18
    ],
    [
      "clojure.core.async.impl.ioc_macros$run_state_machine",
      "invokeStatic",
      "ioc_macros.clj",
      973
    ],
    [
      "clojure.core.async.impl.ioc_macros$run_state_machine",
      "invoke",
      "ioc_macros.clj",
      972
    ],
    [
      "clojure.core.async.impl.ioc_macros$run_state_machine_wrapped",
      "invokeStatic",
      "ioc_macros.clj",
      977
    ],
    [
      "clojure.core.async.impl.ioc_macros$run_state_machine_wrapped",
      "invoke",
      "ioc_macros.clj",
      975
    ],
    [
      "clojure.core.async$ioc_alts_BANG_$fn__16189",
      "invoke",
      "async.clj",
      385
    ],
    [
      "clojure.core.async$do_alts$fn__16129$fn__16132",
      "invoke",
      "async.clj",
      254
    ],
    [
      "clojure.core.async.impl.channels.ManyToManyChannel$fn__12258",
      "invoke",
      "channels.clj",
      265
    ],
    [
      "clojure.lang.AFn",
      "run",
      "AFn.java",
      22
    ],
    [
      "java.util.concurrent.ThreadPoolExecutor",
      "runWorker",
      "ThreadPoolExecutor.java",
      1149
    ],
    [
      "java.util.concurrent.ThreadPoolExecutor$Worker",
      "run",
      "ThreadPoolExecutor.java",
      624
    ],
    [
      "java.lang.Thread",
      "run",
      "Thread.java",
      748
    ]
  ],
  "cause": "O tempo limite expirou após 20.0 mins.",
  "data": {
    "status": "timed-out",
    "type": "timed-out"
  },
  "_status": "timed-out"
}
{
  "browser-info": {
    "language": "en-US",
    "platform": "Linux x86_64",
    "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
    "vendor": ""
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_275-b01",
    "java.vendor": "Red Hat, Inc.",
    "java.vendor.url": "https://www.redhat.com/",
    "java.version": "1.8.0_275",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.275-b01",
    "os.name": "Linux",
    "os.version": "4.20.12-1.el7.elrepo.x86_64",
    "user.language": "en",
    "user.timezone": "America/Sao_Paulo"
  },
  "metabase-info": {
    "databases": [
      "presto",
      "mysql"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MySQL",
        "version": "5.7.26-log"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.6.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.37.4",
      "date": "2020-12-17",
      "branch": "release-x.37.x",
      "hash": "e0d5287"
    },
    "settings": {
      "report-timezone": "America/Sao_Paulo"
    }
  }
}

Hi @marcello.dimarino

You are hitting the hardcoded timeout of 20 minutes - Timed out after 20.0 mins.
https://github.com/metabase/metabase/blob/2a0683bc3dcf1b3e11e41d073c84bac71b3ddce5/src/metabase/query_processor/context/default.clj#L19

Generating XLSX is a very CPU intensive process, which only runs on a core to avoid blocking the entire instance, but means it’s slower.
https://github.com/metabase/metabase/issues/7943 - upvote by clicking :+1: on the first post

How many rows and columns are you returning?
How many resources does Metabase have available - CPU and RAM?

I’m sure if you export as CSV, then it will take querying time (~1 minute) plus a few seconds.

1 Like

Thanks @flamber.

Query returns ~160.000 lines and has 33 columns.

Currently we are running it in a AWS instance with 64Gb of ram and 8 cpu cores.

Do you know on which version this hard coded limit of 20 minutes has been introduced?

@marcello.dimarino Which version did you upgrade from? There has always been timeouts, but I would think the one you are seeing was introduced in 0.35.0 with the new query processor and connection handling.

We upgraded from 0.32.10.