# Oops error due to database timeout

**URL:** https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895
**Category:** Self-hosting
**Created:** [April 15, 2021, 2:29am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895 "2021-04-15T02:29:24Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:29am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/1 "2021-04-15T02:29:24Z")

</div>

the request for home page [http://10.201.61.8/forum](http://10.201.61.8/forum)  
the request time has exceed 5 seconds.  
 ![image](https://global.discourse-cdn.com/meta/original/3X/4/5/45d9607da8b97e76e9f4f49c3b7d22fe08692ae1.png)

we always get the error Oops  
Is there any restriction about a request exceed 5 seconds, or any other restriction？thanks!

> Oops
> 
> The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.
> 
> Detailed information about the error was logged, and an automatic notification generated. We’ll take a look at it.
> 
> No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site’s feedback category.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 15, 2021, 2:30am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/2 "2021-04-15T02:30:17Z")

</div>

Sounds like you are running a custom proxy in front of the site that is timing it out.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:31am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/3 "2021-04-15T02:31:16Z")

</div>

yes  
we use a custom nginx proxy outside.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 15, 2021, 2:32am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/4 "2021-04-15T02:32:00Z")

</div>

Looks like you need to amend config on the custom nginx proxy outside then

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:33am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/5 "2021-04-15T02:33:52Z")

</div>

sometimes we can access the web normal  
when the request time is not execeed 5 seconeds.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:36am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/6 "2021-04-15T02:36:05Z")

</div>

so all the config can work right.  
but when the request exceed 5 seconds we just get Oops  
I doubt there is some restiction about the reqeust exceed 5 seconds.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:41am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/7 "2021-04-15T02:41:23Z")

</div>

the custom nginx config outside as below

```plaintext
server {
  listen 9000;
  server_name localhost;
  root /opt/nginx/portal;
  location ~* ^.+\.(jpg|jpeg|gif|png|bmp)$ {
    access_log off;
    expires 30d;
    break;
  }
  location / {
    index index.html index.htm;
  }
  
  location ^~/forum {
   add_header 'Access-Control-Allow-Origin' '*';
   add_header 'Access-Control-Allow-Credentials' 'true';
   add_header 'Access-Control-Allow-Headers' '*';
   proxy_pass http://unix:/opt/oca-forum/shared/ocaforum/nginx.http.sock:;
   proxy_redirect off;
   }
}
```

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 2:47am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/8 "2021-04-15T02:47:59Z")

</div>

the app.yml as below:

```plaintext
templates:
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/cron.template.yml"
  - "templates/web.china.template.yml" 
  - "templates/web.socketed.template.yml"  

params:
  db_default_text_search_config: "pg_catalog.english"
  db_shared_buffers: "1280MB"

env:
  LC_ALL: en_US.UTF-8
  LANG: en_US.UTF-8
  LANGUAGE: en_US.UTF-8
  
  UNICORN_WORKERS: 8

  DISCOURSE_HOSTNAME: '10.201.61.8:9000'
  DOCKER_USE_HOSTNAME: false
  
  DISCOURSE_RELATIVE_URL_ROOT: /forum

  DISCOURSE_DEVELOPER_EMAILS: 'jxwoeuxer@gmail.com'

  DISCOURSE_SMTP_ADDRESS: gmail.smtp.com
  DISCOURSE_SMTP_PORT: 25
  DISCOURSE_SMTP_USER_NAME: jzwoeuxer@gmail.com
  DISCOURSE_SMTP_PASSWORD: "WEweoier2x2w3e"
  DISCOURSE_SMTP_ENABLE_START_TLS: false # (optional, default true)
  DISCOURSE_SMTP_AUTHENTICATION: login
  DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none

  DISCOURSE_NOTIFICATION_EMAIL: jxwoeuxer@gmail.com # (address to send notifications from)

  DISCOURSE_DB_HOST: 10.201.61.16
  DISCOURSE_DB_PORT: 5432
  DISCOURSE_DB_NAME: theforum
  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_USERNAME: postgres
  DISCOURSE_DB_PASSWORD: theforum16

volumes:
  - volume:
      host: /opt/oca-forum/shared/ocaforum
      guest: /shared
  - volume:
      host: /opt/oca-forum/shared/ocaforum/log/var-log
      guest: /var/log

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com.cnpmjs.org/discourse/docker_manager.git

run:
  - exec: echo "Beginning of custom commands"
  - exec:
      cd: $home
      cmd:
         - mkdir -p public/forum
         - cd public/forum && ln -s ../uploads && ln -s ../backups
  - replace:
      global: true
      filename: /etc/nginx/conf.d/discourse.conf
      from: proxy_pass http://discourse;
      to: |
         rewrite ^/(.*)$ /forum/$1 break;
         proxy_pass http://discourse;
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: location ~ ^/(svg-sprite/|letter_avatar/|letter_avatar_proxy/|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker) {
      to: |
        location ~ ^/(svg-sprite/|letter_avatar/|letter_avatar_proxy/|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker) {
        rewrite ^/(svg-sprite|letter_avatar|letter_avatar_proxy|user_avatar|highlight-js|stylesheets|theme-javascripts|favicon/proxied|service-worker)/([^/]+):[0-9]+/(.*) /forum/$1/$2/$3 break; 
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: etag off;
      to: |
        etag off;
        location /forum {
           rewrite ^/forum/?(.*)$ /$1;
        }
  - replace:
       filename: /etc/nginx/conf.d/discourse.conf
       from: $proxy_add_x_forwarded_for
       to: $http_your_original_ip_header
       global: true
  - exec: echo "End of custom commands"
```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 15, 2021, 4:35am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/11 "2021-04-15T04:35:37Z")

</div>

Try removing the reverse proxy and letting the container bind to the 80/443 ports directly and see if the problem persists.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 4:37am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/12 "2021-04-15T04:37:34Z")

</div>

thank you!  
but I must use the outside nginx for there are not any more port for mydiscourse.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 4:38am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/13 "2021-04-15T04:38:53Z")

</div>

I have enter the discourse container and run

curl `http://localhost:3000/forum` then I get the same error

```plaintext
---
# # # curl http://localhost:3000/forum
<!DOCTYPE html>
<html>
<head>
  <title>Oops - Error 500</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
    <h1>Oops</h1>
    <p>The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.</p>
    <p>Detailed information about the error was logged, and an automatic notification generated. We'll take a look at it.</p>
    <p>No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site's feedback category.</p>
</body>
</html>
```

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 4:42am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/14 "2021-04-15T04:42:58Z")

</div>

I use your open discourse  
I just need to use a outside nginx and need a subfolder for the url path  
@Falco

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 6:46am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/15 "2021-04-15T06:46:25Z")

</div>

maybe there are some reason about the db  
I find the db is very slowly.  
I have changed the db\_timeout = 10 ,then we get error after 10 seconds.  
maybe I should let the db fast.

---

<div class="post-metadata">

### Author: ![shantaram](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@shantaram](https://meta.discourse.org/u/shantaram)
#### Post date: [April 15, 2021, 9:53am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/16 "2021-04-15T09:53:56Z")

</div>

I have fixed the problem. the 5 seconds setting is a default db setting. we has change the setting as below:

```
DISCOURSE_DB_TIMEOUT: 10000
DISCOURSE_DB_CONNECT_TIMEOUT: 10

```

and more  
we find the db is very slowly.  
and we have use a new db on linux instead of the old one on windows.

thank you all the same. discourse is very wonderful.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 15, 2021, 9:54am UTC](https://meta.discourse.org/t/oops-error-due-to-database-timeout/186895/17 "2021-05-15T09:54:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
