Oops error due to database timeout

the request for home page http://10.201.61.8/forum
the request time has exceed 5 seconds.
image

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.

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

1 Like

yes
we use a custom nginx proxy outside.

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

1 Like

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

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.

the custom nginx config outside as below

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;
   }
}

the app.yml as below:

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"

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

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

I have enter the discourse container and run

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

---
# # # 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>

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

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.

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.

3 Likes

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