#164 new
John Cant

Thin won't work in cluster

Reported by John Cant | July 29th, 2012 @ 07:29 PM | in Future

Hi all,

I'm running two rails apps with nginx and thin. Only one of the thin processes actually works - half of all requests to each site result in a 502 Bad Gateway from nginx, and thin spits out

"!! Unexpected error while processing request: deadlock; recursive locking"

to the logfile. What am I doing wrong, or is this a bug in thin?

I'm using thin 1.4.1 Chromeo

Here is my nginx config

/etc/nginx/sites-available/MyApp: upstream cluster_MyApp {
server unix:/home/ubuntu/MyApp/tmp/sockets/thin.0.sock; server unix:/home/ubuntu/MyApp/tmp/sockets/thin.1.sock; }

MyApp config
server {
listen 80; server_name myapp.com; server_name www.myapp.com; root /home/ubuntu/MyApp/public; location / {

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

proxy_pass http://cluster_MyApp;

} }

/etc/nginx/sites-available/redmine:

upstream cluster_redmine {
server unix:/home/ubuntu/redmine-2.0.3/tmp/sockets/thin.0.sock; server unix:/home/ubuntu/redmine-2.0.3/tmp/sockets/thin.1.sock; }

server {
listen 80; server_name redmine.myapp.com; root /home/ubuntu/redmine-2.0.3/public; location / {

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

proxy_pass http://cluster_redmine;

} }

Thin config for MyApp:

chdir: /home/ubuntu/MyApp
environment: production
address: 0.0.0.0
port: 80
timeout: 600
log: log/thin.log
socket: tmp/sockets/thin.sock
max_conns: 1024
max_persistent_conns: 512
require: []
wait: 120
servers: 2
daemonize: true
onebyone: true
no-epoll: true
tag: myapp_thin

Thin config for redmine

chdir: /home/ubuntu/redmine-2.0.3
environment: production
address: 0.0.0.0
port: 80
timeout: 600
log: log/thin.log
socket: tmp/sockets/thin.sock
max_conns: 1024
max_persistent_conns: 512
require: []
wait: 300
servers: 2
daemonize: true
onebyone: true
no-epoll: true
tag: redmine_thin

Cheers

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages