mathesar-foundation / mathesar

Web application providing an intuitive user experience to databases.
https://mathesar.org/
GNU General Public License v3.0
2.28k stars 316 forks source link

Unable to add new DB connection to preexisting DB with WORKER TIMEOUT error #3537

Closed edmundophie closed 2 months ago

edmundophie commented 2 months ago

Description

I've managed to install mathesar on AWS EC2 instance and can setup the user succesfully. However I got an error when I tried to add a new DB connection to my existing DB in Supabase. When I added the DB connection, the browser takes so long that results in 502 error. The container logs showed that there was a WORKER TIMEOUT as can be seen below. Subsequently, I can no longer access the mathesar web at all, due to the same WORKER TIMEOUT error.

addy-reverse-proxy-1  | {"level":"error","ts":1713043399.774934,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"GET","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/favicon.ico","headers":{"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Cookie":[],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Dnt":["1"],"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"]}},"bytes_read":0,"user_id":"","duration":0.038846956,"size":1416,"status":404,"resp_headers":{"Content-Encoding":["gzip"],"X-Frame-Options":["DENY"],"Server":["Caddy","gunicorn"],"X-Content-Type-Options":["nosniff"],"Date":["Sat, 13 Apr 2024 21:23:19 GMT"],"Content-Language":["en"],"Referrer-Policy":["same-origin"],"Cross-Origin-Opener-Policy":["same-origin"],"Content-Type":["text/html; charset=utf-8"],"Vary":["Accept-Language, Cookie","Accept-Encoding"]}}
caddy-reverse-proxy-1  | {"level":"info","ts":1713043399.7963896,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"GET","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/static/assets/en.68223d1c.js","headers":{"Accept-Encoding":["gzip, deflate"],"Cookie":[],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64;x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Connection":["keep-alive"],"Origin":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com"],"Dnt":["1"],"Accept":["*/*"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"]}},"bytes_read":0,"user_id":"","duration":0.000249769,"size":13623,"status":200,"resp_headers":{"Server":["Caddy"],"Content-Encoding":["gzip"],"Vary":["Accept-Encoding"],"Etag":["\"sbwgpkaif\""],"Content-Type":["text/javascript; charset=utf-8"],"Last-Modified":["Sat, 13 Apr 2024 21:22:32 GMT"],"Accept-Ranges":["bytes"]}}
mathesar_service       | Skipping installing on DB with key postgres.
caddy-reverse-proxy-1  | {"level":"error","ts":1713043423.6460078,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"POST","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/api/ui/v0/connections/create_from_scratch/","headers":{"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Content-Type":["application/json"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Accept":["*/*"],"Accept-Encoding":["gzip, deflate"],"Cookie":[],"Dnt":["1"],"X-Csrftoken":["0k2AhDfqOqLienoY0Ddjwi1VZdFcfwjD"],"Origin":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com"],"Content-Length":["212"]}},"bytes_read":212,"user_id":"","duration":0.468366309,"size":248,"status":500,"resp_headers":{"Content-Length":["248"],"Content-Language":["en"],"X-Content-Type-Options":["nosniff"],"Content-Type":["application/json"],"Vary":["Accept, Accept-Language, Cookie"],"X-Frame-Options":["DENY"],"Referrer-Policy":["same-origin"],"Server":["Caddy","gunicorn"],"Cross-Origin-Opener-Policy":["same-origin"],"Date":["Sat, 13 Apr 2024 21:23:43 GMT"],"Allow":["POST, OPTIONS"]}}
caddy-reverse-proxy-1  | {"level":"info","ts":1713043425.5330665,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"GET","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/static/assets/main.aabda8e1.ddfa5af22743.css","headers":{"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Dnt":["1"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/"],"Cookie":[],"If-None-Match":["\"sbwgpljuv\""],"If-Modified-Since":["Sat, 13 Apr 2024 21:22:33 GMT"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Accept":["text/css,*/*;q=0.1"]}},"bytes_read":0,"user_id":"","duration":0.000316317,"size":0,"status":304,"resp_headers":{"Etag":["\"sbwgpljuv\""],"Server":["Caddy"],"Vary":["Accept-Encoding"]}}
mathesar_service       | Installing Mathesar on preexisting PostgreSQL database postgres at host aws-0-ap-southeast-1.pooler.supabase.com...
mathesar_service       | [2024-04-13 21:24:30 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:10)
caddy-reverse-proxy-1  | {"level":"error","ts":1713043470.853193,"logger":"http.log.error.log0","msg":"EOF","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"POST","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/api/ui/v0/connections/create_from_scratch/","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Content-Type":["application/json"],"Origin":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com"],"X-Csrftoken":["0k2AhDfqOqLienoY0Ddjwi1VZdFcfwjD"],"Accept-Encoding":["gzip, deflate"],"Accept":["*/*"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Cookie":[],"Connection":["keep-alive"],"Content-Length":["215"],"Dnt":["1"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/"]}},"duration":30.200051451,"status":502,"err_id":"nd1f7kkuk","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}
caddy-reverse-proxy-1  | {"level":"error","ts":1713043470.853249,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"POST","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/api/ui/v0/connections/create_from_scratch/","headers":{"Connection":["keep-alive"],"Content-Length":["215"],"Dnt":["1"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Content-Type":["application/json"],"Origin":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com"],"X-Csrftoken":["0k2AhDfqOqLienoY0Ddjwi1VZdFcfwjD"],"Accept-Encoding":["gzip, deflate"],"Accept":["*/*"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Cookie":[]}},"bytes_read":215,"user_id":"","duration":30.200051451,"size":0,"status":502,"resp_headers":{"Server":["Caddy"]}}
mathesar_service       | [2024-04-13 21:24:30 +0000] [10] [INFO] Worker exiting (pid: 10)
mathesar_service       | [2024-04-13 21:24:31 +0000] [91] [INFO] Booting worker with pid: 91
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Skipped unsupported reflection of expression-based index users_instance_id_email_idx
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Did not recognize type 'realtime.user_defined_filter' of column 'filters'
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Did not recognize type 'regrole' of column 'claims_role'
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Skipped unsupported reflection of expression-based index sso_providers_resource_id_idx
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Skipped unsupported reflection of expression-based index sso_domains_domain_idx
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Skipped unsupported reflection of expression-based index sso_providers_resource_id_idx
mathesar_service       |   return Table(
mathesar_service       | /code/db/tables/operations/select.py:20: SAWarning: Skipped unsupported reflection of expression-based index users_instance_id_email_idx
mathesar_service       |   return Table(
mathesar_service       | [2024-04-13 21:28:22 +0000] [9] [CRITICAL] WORKER TIMEOUT (pid:91)
caddy-reverse-proxy-1  | {"level":"error","ts":1713043702.695714,"logger":"http.log.error.log0","msg":"EOF","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"GET","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/","headers":{"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Connection":["keep-alive"],"Dnt":["1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate"],"Cookie":[],"Cache-Control":["max-age=0"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/auth/create_superuser/"]}},"duration":30.066581907,"status":502,"err_id":"xyzhy5ypq","err_trace":"reverseproxy.statusError (reverseproxy.go:1267)"}
caddy-reverse-proxy-1  | {"level":"error","ts":1713043702.6957622,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"110.137.157.186","remote_port":"61525","client_ip":"110.137.157.186","proto":"HTTP/1.1","method":"GET","host":"ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com","uri":"/","headers":{"Cache-Control":["max-age=0"],"Referer":["http://ec2-16-78-46-190.ap-southeast-3.compute.amazonaws.com/auth/create_superuser/"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-GB,en;q=0.9,id-ID;q=0.8,id;q=0.7,en-US;q=0.6"],"Connection":["keep-alive"],"Dnt":["1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Cookie":[]}},"bytes_read":0,"user_id":"","duration":30.066581907,"size":0,"status":502,"resp_headers":{"Server":["Caddy"]}}

The webpage error: image

I've tried running mathesar on my local PC to connect to Supabase DB, the same issue persists.

Expected behavior

To Reproduce

  1. Install mathesar in AWS EC2
  2. Add new DB connection to a postgres DB in supabase
  3. Mathesar container should get a WORKER TIMEOUT error, and browser returns 502 error code.

Environment

Additional context

kgodey commented 1 month ago

@edmundophie I'm just following up on some of our older issues – did this successfully resolve for you?