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

Query timeout issue #46

Closed
howinator opened this issue Jun 25, 2020 · 13 comments
Closed

Query timeout issue #46

howinator opened this issue Jun 25, 2020 · 13 comments

Comments

@howinator
Copy link

howinator commented Jun 25, 2020

Metabase version: 0.35.4
Athena Driver version: v1.0.0

We have an Athena database which isn't optimized, so queries to it often time out after 5 minutes with the following message on the front end:
image

I checked in the Athena console and these queries are timing out at ~298s (~5 minutes).

In the metabase logs I see the following:

Caused by: com.simba.athena.dsi.exceptions.OperationCanceledException: [Simba][AthenaJDBC](100081) Query execution got cancelled for this query

I've tried setting the MB_DB_CONNECTION_TIMEOUT_MS env var to 1200000 (20 minutes), but it had no effect. A cursory google search showed that this was something that came up with the Druid driver, and it was changed.

If I'm not missing an existing configuration parameter, would it be possible to get something similar for this Athena driver? Thanks so much in advance!

@howinator howinator changed the title Add configuration parameter for query timeout. Query timeout issue Jun 26, 2020
@dacort
Copy link
Owner

dacort commented Jun 27, 2020

Hi @howinator, thanks for filing the issue. Timeouts are always so much fun. :)

I believe Athena's default timeout is 30 minutes.
MB_DB_CONNECTION_TIMEOUT_MS is for the initial DB connection tests, so won't impact a running query.

Then there's also frontend timeouts, which this may be (see metabase/metabase#12423). Where are you running Metabase and is there a load balancer in front of it?

@howinator
Copy link
Author

Hey @dacort thanks for the response. There is a LB in front of it, but I configured it to have a longer timeout to no effect. I'm not familiar with the architecture of Metabase, but should I expect a OperationCanceledException in the logs if it's a front-end timeout?

@orenmazor
Copy link

orenmazor commented Jun 29, 2020

some of my users started hitting this as well. I'm running a default elastic beanstalk setup right now while we're figuring out if this is the right solution. I'd love to be able to bump the timeout to 30m

I get that this will result on hitting that EB instance heavier, and I'm very ok with that. thats a moneyscale issue in my books.

@dacort
Copy link
Owner

dacort commented Jun 30, 2020

Thanks @howinator and @orenmazor - I'll try to dig into this this week and figure out the right solution.

@orenmazor
Copy link

orenmazor commented Jun 30, 2020 via email

@dacort
Copy link
Owner

dacort commented Jun 30, 2020

I'm also running beanstalk and tried changing the "idle timeout" setting on the load balancer to 600 seconds and that seemed to work, although I didn't test it with the Athena driver directly but another long-running query.

I should note that if you haven't, you should also consider enabling caching on the Metabase side so these long-running queries will be cached for some period.

@orenmazor
Copy link

@dacort I've enabled caching. I'm also playing around with actually pulling those cached queries somehow into being visible in the main metabase landing page. kind of like "here are the last 20 queries people ran". but that's more of a metabase discussion and less of the athena driver :)

@orenmazor
Copy link

I set the idle timeout on the elb to a higher amount and still seeing the same timeout issue, btw.

@orenmazor
Copy link

orenmazor commented Jul 25, 2020

so this has cropped up further on my priority list and now i have to dig at this.

I started looking at logs, and one thing I noticed is that athena is showing queries getting cancelled at 60s, and the logs are showing the same error as above. so it looks like an active kill :(

@orenmazor
Copy link

update! figured it out.

the issue isn't the ELB. it's nginx as the proxy on the EB box. you need to adjust the timeout settings with whichever way you prefer to manage your host config.

I adjusted my elasticbeanstalk folder to just add these to the http config:

        client_header_timeout   1800;
        client_body_timeout     1800;
        send_timeout            1800;
        proxy_connect_timeout   1800;
        proxy_read_timeout      1800;
        proxy_send_timeout      1800;

@dacort
Copy link
Owner

dacort commented Jul 26, 2020

Ah thanks @orenmazor! The default Metabase EB config has the timeouts set at 600s as an FYI.

@dacort
Copy link
Owner

dacort commented Aug 24, 2020

Going to close this one as I believe it's due to load balancer configuration/timeouts.

@howinator Feel free to reopen if you feel otherwise!

@dacort dacort closed this as completed Aug 24, 2020
@jensenity
Copy link

I'm running metabase on k8s with nginx, does this mean I have to configure a longer nginx client timeout to avoid this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants