Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda