Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
socket() failed (24: Too many open files) while connecting to upstream Action cable Ruby on Rails

We're working on chat app project using RubyOnRails. The app we developed working on local without any issue. However, it gives an error while trying to connect the web socket from outside. Our requirement is to use these chat app apis from an Android app.

We're using following technologies/frameworks

  • Rails 5.0.0
  • Ruby 2.2.2
  • Action cable
  • Passenger
  • Nginx
  • Redis

/etc/nginx/sites-enabled/chatroom_demo

server {
  listen 80 default_server;
  server_name xx.xxx.xxx.xxx;
  passenger_enabled on;
  passenger_app_env production;
  root /home/projects/chatroom_demo/public;

  location /cable {
       passenger_app_group_name chatroom_demo_action_cable;
       passenger_force_max_concurrent_requests_per_process 0;

       proxy_pass http://xx.xxx.xxx.xxx;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
    }
}

/etc/nginx/nginx.conf

user www-data;
worker_processes auto;
worker_rlimit_nofile 16384;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 20000;
    # multi_accept on;
}

config/cable.yml

production:
  adapter: redis
  url: redis://localhost:6379

config/environments/production.rb

config.action_cable.url = [/ws:\/\/*/, /wss:\/\/*/]
config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]

Client side we're tying to connect using following code:

let socket = new WebSocket("ws://XX.XXX.XXX.XXX/cable");

socket.onopen = function(e) {
  alert("[open] Connection established");  
};

socket.onerror = function(error) {
  alert(`[error] ${error.message}`);
};

Client side error: Undefined Server side error:

*32764 socket() failed (24: Too many open files) while connecting to upstream, client: XX.XXX.XXX.XXX, server: XX.XXX.XXX.XXX, request: "GET /cable HTTP/1.1", upstream: "http://XX.XXX.XXX.XXX:80/cable", host: "XX.XXX.XXX.XXX"

We have tried many different ways to fix this issue but couldn't find any potential fix.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Did you also update your sysd nolimitfile settings to be something > worker_rlimit_nofile 16384? More info in this solution.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda