Graham Christensen | 20 May 2013 18:46
Gravatar

Unicorn + RUnit Rails Not Killing Old Master

Hi,

I'm deploying Unicorn on a Rails application with RUnit. Technically 
I'm using Chef's deployment tools, if any of you are familiar with it 
(https://github.com/opscode-cookbooks/application_ruby) but to be clear 
they aren't doing anything magical, so this is purely an issue with 
RUnit and Unicorn.

The TL;DR of the following post, which has lots of pastes (linking to 
pastebins for easier reading:) when I run /etc/init.d/myzippykid 
restart, the old unicorn master fails to die, causing the new master to 
be stuck in a loop waiting to own port 8080. The new master never takes 
over, as the old master never dies. When I manually kill the master, 
the new one takes over just fine.

What am I missing in my restart process to make the old master exit?

--

More details:

When I deploy a new version of software, the unicorn master fails to 
restart. Here is an example of my ps auxfg output after I run 
`/etc/init.d/myzippykid restart` (which is symlinked to /usr/bin/sv): 
https://gist.github.com/grahamc/35715c1a2c9717e461e3

When I run `killall unicorn`, the ruby script under runsvdir gets 
replaced with the unicorn worker. This is because the ruby script is 
attempting to bind to port 8080, which is already taken up by the 
unicorn master process. As soon as the old master is out of the way, 
(Continue reading)

Andrew Stewart | 15 May 2013 10:52
Gravatar

Growing memory use of master process

Hello,

I was wondering why my Unicorn master process's memory use grows over
time.

As as I understand it, when I (re)start Unicorn a master process spins
up which loads my Rails app.  The master process then brings up worker
processes which handle traffic to the app.

As time passes I'm not surprised to see the workers use more memory:
Ruby 1.9's garbage collector doesn't free as much memory as it could and
it's not inconceivable that my code is somewhat relaxed about creating
objects.

However if the workers are handling the traffic, why does the master
process's footprint grow?  Is it simply the inefficient garbage
collector or is there another reason which, hopefully, I could address?

Thanks in advance.

Yours,
Andy Stewart

_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

pille | 12 May 2013 20:12
Picon
Favicon

add HTTP response headers

hi,

is it possible to add static and dynamic HTTP response headers in
unicorn.conf.rb?

i'd like to add the hostname of the worker for debugging and a
timestamp, when the request was worked on.

currently this is done in nginx, which should be stripped from the stack.
i'd like to keep it out of the webapp itself, because it's infrastructure.

cheers
  pille
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Bogdan Dumitru | 10 May 2013 15:00
Picon

Unicorn behaving irrationally in production after a day

Hey guys,

I'm new to Unicorn and have been running into a weird issue. I'm currently running a EC2 cluster with each
machine having nginx with 4 unicorn workers. I'm deploying using rubber
(https://github.com/rubber/rubber), and the unicorn.rb config is basically the GitHub unicorn
config (as detailed here: https://github.com/blog/517-unicorn).
Everything works fine when I deploy, but after half a day - 1 day the server behaves irrationally. The server
is an api server for a mobile application so I can easily see some variables that, on request, have a certain
value, but if I do some checking with the rails console (on the production machine) I get  a different value
(the correct one). This seams to me like a weird object caching situation. It all gets solved if I restart unicorn.
I'm not sure what config information you guys might be interested in so I won't bloat this mail with anything
but let me know if there's any questions I can answer.

I hope somebody can point me in the right direction because I can't really make heads or tails of it.
Cheers,
-b

PS: I've read about something similar happening when using memcached for object caching, in a previous
version, but that isn't the case here.

_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Eric Wong | 9 May 2013 01:01

[PATCH] HttpParser#next? becomes response_start_sent-aware

This could allow servers with persistent connection support[1]
to support our check_client_connection in the future.

[1] - Rainbows!/zbatery, possibly others
---
 ext/unicorn_http/unicorn_http.rl |  6 ++----
 test/unit/test_http_parser_ng.rb | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 1a8003f..3529740 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
 <at>  <at>  -732,10 +732,8  <at>  <at>  static VALUE HttpParser_parse(VALUE self)
   struct http_parser *hp = data_get(self);
   VALUE data = hp->buf;

-  if (HP_FL_TEST(hp, TO_CLEAR)) {
-    http_parser_init(hp);
-    rb_funcall(hp->env, id_clear, 0);
-  }
+  if (HP_FL_TEST(hp, TO_CLEAR))
+    HttpParser_clear(self);

   http_parser_execute(hp, RSTRING_PTR(data), RSTRING_LEN(data));
   if (hp->offset > MAX_HEADER_LEN)
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index 93c44bb..ab335ac 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
(Continue reading)

Eric Wong | 4 May 2013 05:04

[PATCH] test_signals: increase delay between Process.kill

Otherwise, the signalled process may take too long to react to
and process all the signals on machines with few CPUs.
---
 I seem to need this on my dual-core laptop running CONFIG_HZ=100
 for the test to run reliably

 pushed to master of git://bogomips.org/unicorn

 test/unit/test_signals.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/test_signals.rb b/test/unit/test_signals.rb
index 84d6a4b..f1d8bb3 100644
--- a/test/unit/test_signals.rb
+++ b/test/unit/test_signals.rb
 <at>  <at>  -174,7 +174,7  <at>  <at>  def test_request_read
     sock.syswrite("Content-Length: #{ <at> bs *  <at> count}\r\n\r\n")
     1000.times { Process.kill(:HUP, pid) }
     size_before =  <at> tmp.stat.size
-    killer = fork { loop { Process.kill(:HUP, pid); sleep(0.0001) } }
+    killer = fork { loop { Process.kill(:HUP, pid); sleep(0.01) } }
     buf = ' ' *  <at> bs
      <at> count.times { sock.syswrite(buf) }
     Process.kill(:KILL, killer)
--

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying
(Continue reading)

Andreas Falk | 25 Apr 2013 10:02
Picon

Why doesn't SIGTERM quit gracefully?

Hi,

I'm wondering why SIGINT and SIGTERM both were chosen for the quick
shutdown? I agree with SIGINT but not with SIGTERM. A lot of unix
tools send SIGTERM as default (kill, runit among some) and it seems to
be the standard way of telling a process to quit gracefully but not
among Ruby people (there are a few other ruby processes behaving the
same way). I just think it's weird that the default command will exit
without taking care of their current request.

Also i'm not on the mailinglist so it would be great if you could cc
mail <at> andreasfalk.se

Regards,
Andreas Falk
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Bill Vieux | 20 Apr 2013 02:52
Picon
Favicon

Worker Timeout Debugging

I am getting occasional worker timeouts for a Rails app hosted on
Heroku. I have rack-timeout set at the top of the middleware with a
shorter timeout than unicorn workers, but it is not firing for some
reason.

Are there any recommended techniques to determine the call stack when
the worker is reaped?

The solutions that come to mind for me seem to require running a
customized build of unicorn. For example: start a script (e.g., gdb to
attach and core dump the worker) before (or in place of) sending the
SIGKILL.
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Rosalind Deters | 16 Apr 2013 13:53
Picon
Favicon

In My Will

Mrs Rosalind Deters
Email:detersrosalind <at> rocketmail.com

Hello Dear,
My name is Rosalind Deters,i am a dying woman who has decided to donate what i have
to you.
I am 59 years old,was diagnosed of cancer about 2 years ago immediately after the
death of my husband,who has left me everything he worked for.
I have been touched by God to donate from what i have inherited from my late husband
to you for the good work of the Lord,rather than to allow my relatives to use my
husband's hard earned funds ungodly.
I decided to WILL/donate the sum of $3,000,000(Three million dollars)to enable you
help the motherless,less priviledged and widows.
I have adjusted my WILL and my lawyer is aware that i have done so,you and my lawyer
shall arrange the transfer of the funds from my account to yours.
I wish you all the best and may the good Lord bless you abundantly,please use the 
funds well and always extend the good work to others.
Contact my lawyer (Barrister.Hans Pieter) with this email:hanspieteresq <at> aol.de and tell him
that i have donated $3,000,000 to you.i have also notified him.
Thanks and Godbless you.
Regards,
Mrs.Rosalind Deters
N.B:I will appreciate your utmost confidentiality in this matter until the task is
accomplished as i do not want anything to jeopardize my last wish.

_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

(Continue reading)

David Wilkins | 5 Apr 2013 23:16
Gravatar

Fedora Unix socket file location problems

Folks,

It seems that it's pretty common to use /tmp for the directory where
you store the Unicorn unix: socket file.   I'm a Fedora user and our
lovable systemd (by default) gives nginx a private /tmp directory (see
"PrivateTmp=true" in system configuration file example below).
That's the kind of thing that *could* take a while to figure out.

Could you put a note somewhere near the listen docs warning Fedora /
systemd users to locate the socket file somewhere else?  I know it's
not your problem, but I'll bet that more than a few Fedora users are
using TCP sockets instead of unix sockets with Unicorn because of
this.

Unicorn is awesome, btw.
Thanks!
dhw

listen docs I referenced:
http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen

systemd configuration file from Fedora 17:
https://gist.github.com/dwilkins/5322665
~
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

(Continue reading)

Jacob | 4 Apr 2013 19:48
Picon
Gravatar

Can Unicorn Listen to an Existing Socket Descriptor?

I know that Unicorn opens and shares it's bound socket amongst its
sub-processes, however I was hoping I could also pre-open a socket to
be handed off to Unicorn.

Thanks

- Jacob Groundwater
_______________________________________________
Unicorn mailing list - mongrel-unicorn <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


Gmane