×

Troubleshooting search error 504

 
When you use the advanced search feature in HTML files exported from Dr.Explain, you may encounter error messages with code 504 instead of search results.
 
A 504 error means the backend took too long to respond. This usually happens when the server is slow or the timeout settings are too low.
 

Common causes

 
  • Resource constraints: the server doesn't have enough CPU or memory. Increase resource limits.
  • Timeout too short: the backend needs more time to respond. Increase the timeout setting.
  • Large operations: indexing or searching large collections takes longer. Wait until indexing is finished or increase the timeout setting.
  • Slow Solr: the Solr service is slow. Increase its CPU or RAM allocation (low RAM might force Solr to waste CPU resources on freeing up previously allocated RAM).
 

Step 1: Check server resources

 
This step requires access to your server via SSH and Docker.
 
Check if the server is using too many resources:
 
docker compose stats
 
Look for: high CPU or memory usage on the backend or Solr containers.
 
If resources are maxed out: the server might be slow due to resource constraints. Go to Step 2.
 
If resources look fine: the timeout might be too short. Go to Step 3.
 

Step 2: Increase resources

 
This step requires access to your docker-compose.yaml file.
 
If the backend or Solr containers don't have enough resources:
 
Increase the CPU or memory limits in your docker-compose.yaml file:
 
solr:
  deploy:
    resources:
      limits:
        cpus: '2.0'  # Increase if too low
        memory: 2G   # Increase if needed
 
After making changes:
 
docker compose down
docker compose up -d
 
Wait a few minutes and test again.
 

Step 3: Check timeout settings

 
This step requires access to your server's configuration files.
 
For nginx servers:
 
Check the proxy_read_timeout setting:
 
location ~ /drexsearch/(.*)$ {
    proxy_read_timeout 60s;
    proxy_pass http://127.0.0.1:8082/$1$is_args$args;
}
 
If the timeout is too low (e.g., 30s): increase it to 60s or higher.
 
After making changes: restart nginx:
 
sudo nginx -t
sudo systemctl reload nginx
 

Step 4: Check backend logs

 
This step requires access to your server via SSH and Docker.
 
Check if the backend is having problems:
 
docker compose logs drexplain-search-backend-controller
 
Look for: errors, exceptions, or slow operations.
 
If you see errors: address the specific errors mentioned in the logs.
Made by Dr.Explain, software documentation tool