Your question took too long 0.35.1

Hi Guys, I have this message in Metabase after update to 0.35.1 - " Your question took too long" in querys with execution time is more 1 minute, Its possible change this ? I cant find options on Admin settings.

{
  "browser-info": {
    "language": "en-US",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.5+10",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.5",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.5+10",
    "os.name": "Linux",
    "os.version": "4.14.152-98.182.amzn1.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "googleanalytics",
      "postgres",
      "h2",
      "redshift"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "11.5"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2020-04-02",
      "tag": "v0.35.1",
      "branch": "release-0.35.x",
      "hash": "e67f169"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Hi @thiago.tozzi
If you’re using a reverse-proxy (or load balancer) in front of Metabase, then you need to adjust the timeout of that.
You should be able to see what is closing the connection by looking in the browser developer Network-tab, when the request is closed after 60 seconds.

After upgrading from v0.34.3 to v0.35.3 we started having “Your question took too long” in all queries that took longer than 60 seconds to finish. After downgrading this issue disappeared again. We run metabase in k8s. The send/read/connect timeouts of the nginx reverse proxy were set to 120s, so I don’t think the proxy was causing these errors.

@smatting
Open your browser developer Network-tab, start a question, when it fails, you should be able to see the headers from whatever closed the connection.
Also check the Metabase log for any errors. Admin > Troubleshooting > Logs.

hello @flamber I’m seeing the same error after upgrading from v0.34.1 to v0.35.4. Queries time out at 60s, and this didn’t happen before.

From the logs I see that the query is cancelled by the user (?):

:error "ERROR: canceling statement due to user request",

And from the Headers in the network tab I’m seeing a 504 from nginx.

How come this is introduced in this new version?

Hi @jaimeic
There was a massive rewrite of connection handling functionality in 0.35, since there were many other big issues caused by the old method.
Have a read here: https://github.com/metabase/metabase/issues/12423

1 Like

i have followed the explanations
and install my metabase behind a reverse proxy with a keepalive_timeout of 1800s
yet the same problem

any help

@anonymous Then check your browser console to see the headers, when the connection is closed. Perhaps you have multiple proxies. Or perhaps you didn’t configure the proxy correctly, try validating the proxy configuration.

ok checking now…

but below is part of my configuration

        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
    add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';

     location / {
         proxy_set_header X-Forwarded-Host $host;
         proxy_set_header X-Forwarded-Server $host;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http://localhost:3000;
         proxy_http_version 1.1;
         client_max_body_size 1000M;
     }

@anonymous If you’re using a proxy, it would be smart to learn everything about that piece of software, since it’s advanced.
Part of your configurations is not going to help.
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

So when my question takes too long this is the error i get from my console

Failed to load resource: the server responded with a status of 504 (Gateway Time-out)

@anonymous Exactly. That is Nginx closing the connection - click the link I provided above and adjust your configuration.

okay thanks…

but i would like to ask, can it be the case of the user specified in my nginx.conf file ??

@anonymous If you don’t define a configuration directive, then it uses the default, which in this case is 60 seconds.
The problem is not Metabase, but your proxy is closing the connection, so you need to adjust that.