unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] tests: switch to minitest
  @ 2014-04-26  6:07  7% ` Eric Wong
  0 siblings, 0 replies; 6+ results
From: Eric Wong @ 2014-04-26  6:07 UTC (permalink / raw)
  To: Ken Dreyer; +Cc: unicorn-public, mongrel-unicorn

Ken Dreyer <ktdreyer@ktdreyer.com> wrote:
> Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5,
> the shim has lost some backwards compatibility. It is time to make the
> jump to minitest.
> 
> Adjust the unicorn test suite to support Minitest 5's syntax.

Thank you very much for taking a look at this.  I was going to do it
myself over the summer.

I ran into some problems with our tests forking + minitest/autorun
causing some problems due to at_exit usage.

We probably need to workaround, I already did something for yahns
which we can reuse[1] in unicorn.

> Minitest versions 4 and below do not support the newer Minitest::Test
> class that arrived in version 5. For that case, use the
> MiniTest::Unit::TestCase class as a fallback.

For yahns, I did the following:
----------- git://yhbt.net/yahns -- test/helper.rb ------------------
gem 'minitest'
begin # favor minitest 5
  require 'minitest'
  Testcase = Minitest::Test
  mtobj = Minitest
rescue NameError, LoadError # but support minitest 4
  require 'minitest/unit'
  Testcase = Minitest::Unit::TestCase
  mtobj = MiniTest::Unit.new
end

# Not using minitest/autorun because that doesn't guard against redundant
# extra runs with fork.  We cannot use exit! in the tests either
# (since users/apps hosted on yahns _should_ expect exit, not exit!).
TSTART_PID = $$
at_exit do
  # skipping @@after_run stuff in minitest since we don't need it
  case $!
  when nil, SystemExit
    exit(mtobj.run(ARGV)) if $$ == TSTART_PID
  end
end
-------------------------------- 8< -------------------------------
I'd appreciate a second opinion on what I did with yahns above,
but it should work with unicorn.

Can you take a look at integrating+fixing those cases which fork?
Thanks again.

> Please keep me in the CC as I'm not subscribed to the unicorn email list.

No problem.  Also keeping unicorn-public@bogomips.org Cc-ed since that's
the new public-inbox[2] address and reply-all will be the norm there.
Hopefully public-inbox can encourage more drive-by contributors like
you :)


[1] - Fwiw, I give myself permission to relicense any yahns GPLv3+
      test code I wrote to (GPLv2+ || Ruby 1.8 license) for unicorn.
[2] - http://public-inbox.org/

^ permalink raw reply	[relevance 7%]

* Re: Maintaining capacity during deploys
  @ 2012-11-29 23:09  6%   ` Alex Sharp
  0 siblings, 0 replies; 6+ results
From: Alex Sharp @ 2012-11-29 23:09 UTC (permalink / raw)
  To: unicorn list

I remember seeing a gist of a cap script a year or so ago that did something like you're suggesting with TTOU. I know unicorn supports TTOU, but I've never personally done anything different than just using QUIT. 

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

^ permalink raw reply	[relevance 6%]

* Re: Unicorn 0.97.0 old master is never dying
  2010-03-18 16:35  0%   ` ghazel
@ 2010-03-19  8:23  0%     ` Eric Wong
  0 siblings, 0 replies; 6+ results
From: Eric Wong @ 2010-03-19  8:23 UTC (permalink / raw)
  To: ghazel; +Cc: unicorn list

ghazel@gmail.com wrote:
> On Thu, Mar 18, 2010 at 1:40 AM, Eric Wong <normalperson@yhbt.net> wrote:
> > ghazel@gmail.com wrote:
> >> I upgraded to Unicorn 0.97.0 from 0.96.1. Unicorn starts fine, but
> >> sending a USR2 to the 0.97.0 master launches a new master and all the
> >> workers, but never kills the old master. The new workers retry binding
> >> their admin TCP ports forever. Killing all the Unicorns and
> >> downgrading to returns peace to the forest.
> >>
> >> Here are the before_fork and after_fork from my config/unicorn.rb:
> >> http://codepad.org/5LyVtyq7
> >>
> >> Did something change with the Unicorn master in 0.97.0 that would
> >> require a change in my config, or is this a bug?
> >>
> >> -Greg
> >
> > Hi Greg,
> >
> > Odd, are you passing the pid file path via the command-line?
> >
> > I don't see the pid directive in the config file you posted there, so
> > there was nothing to check with File.exists?.  Are you using `unicorn'
> > or `unicorn_rails'?
> >
> > There were some startup changes in 0.97.0, but I couldn't reproduce what
> > you're seeing with 'pid'.  That said, I'm not sure if that method of
> > killing old masters in the after_fork is very common.
> >
> > --
> > Eric Wong
> >
> 
> Eric,
> 
> I am using "unicorn_rails -D -E $ENV -c config/unicorn.rb". Here is
> the entire config file: http://codepad.org/v6lUsuzD

Ugh.  I can't even get to that file right now.  I actually prefer
to have config files inline so:

a) I can comment easily on them
b) I don't have to be online when reading them
   (I sync my mail to a local machine and lose connectivity often)


On a side note, maybe an strace/truss can help figure out what's
going on.  James seems to be having a similar problem in the other
thread...

> What is the preferred way to do an nginx-style restart? My system does
> not really have the memory to start twice the number of workers.

If you're doing it during low traffic periods, I would SIGTTOU away
most (maybe all but one) of your workers and then SIGHUP the master

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


^ permalink raw reply	[relevance 0%]

* Re: Unicorn 0.97.0 old master is never dying
  2010-03-18  8:40  0% ` Eric Wong
@ 2010-03-18 16:35  0%   ` ghazel
  2010-03-19  8:23  0%     ` Eric Wong
  0 siblings, 1 reply; 6+ results
From: ghazel @ 2010-03-18 16:35 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn list

On Thu, Mar 18, 2010 at 1:40 AM, Eric Wong <normalperson@yhbt.net> wrote:
> ghazel@gmail.com wrote:
>> I upgraded to Unicorn 0.97.0 from 0.96.1. Unicorn starts fine, but
>> sending a USR2 to the 0.97.0 master launches a new master and all the
>> workers, but never kills the old master. The new workers retry binding
>> their admin TCP ports forever. Killing all the Unicorns and
>> downgrading to returns peace to the forest.
>>
>> Here are the before_fork and after_fork from my config/unicorn.rb:
>> http://codepad.org/5LyVtyq7
>>
>> Did something change with the Unicorn master in 0.97.0 that would
>> require a change in my config, or is this a bug?
>>
>> -Greg
>
> Hi Greg,
>
> Odd, are you passing the pid file path via the command-line?
>
> I don't see the pid directive in the config file you posted there, so
> there was nothing to check with File.exists?.  Are you using `unicorn'
> or `unicorn_rails'?
>
> There were some startup changes in 0.97.0, but I couldn't reproduce what
> you're seeing with 'pid'.  That said, I'm not sure if that method of
> killing old masters in the after_fork is very common.
>
> --
> Eric Wong
>

Eric,

I am using "unicorn_rails -D -E $ENV -c config/unicorn.rb". Here is
the entire config file: http://codepad.org/v6lUsuzD

What is the preferred way to do an nginx-style restart? My system does
not really have the memory to start twice the number of workers.

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

^ permalink raw reply	[relevance 0%]

* Re: Unicorn 0.97.0 old master is never dying
  2010-03-17  9:51  6% Unicorn 0.97.0 old master is never dying ghazel
@ 2010-03-18  8:40  0% ` Eric Wong
  2010-03-18 16:35  0%   ` ghazel
  0 siblings, 1 reply; 6+ results
From: Eric Wong @ 2010-03-18  8:40 UTC (permalink / raw)
  To: unicorn list; +Cc: ghazel

ghazel@gmail.com wrote:
> I upgraded to Unicorn 0.97.0 from 0.96.1. Unicorn starts fine, but
> sending a USR2 to the 0.97.0 master launches a new master and all the
> workers, but never kills the old master. The new workers retry binding
> their admin TCP ports forever. Killing all the Unicorns and
> downgrading to returns peace to the forest.
> 
> Here are the before_fork and after_fork from my config/unicorn.rb:
> http://codepad.org/5LyVtyq7
> 
> Did something change with the Unicorn master in 0.97.0 that would
> require a change in my config, or is this a bug?
> 
> -Greg

Hi Greg,

Odd, are you passing the pid file path via the command-line?

I don't see the pid directive in the config file you posted there, so
there was nothing to check with File.exists?.  Are you using `unicorn'
or `unicorn_rails'?

There were some startup changes in 0.97.0, but I couldn't reproduce what
you're seeing with 'pid'.  That said, I'm not sure if that method of
killing old masters in the after_fork is very common.

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


^ permalink raw reply	[relevance 0%]

* Unicorn 0.97.0 old master is never dying
@ 2010-03-17  9:51  6% ghazel
  2010-03-18  8:40  0% ` Eric Wong
  0 siblings, 1 reply; 6+ results
From: ghazel @ 2010-03-17  9:51 UTC (permalink / raw)
  To: mongrel-unicorn

I upgraded to Unicorn 0.97.0 from 0.96.1. Unicorn starts fine, but
sending a USR2 to the 0.97.0 master launches a new master and all the
workers, but never kills the old master. The new workers retry binding
their admin TCP ports forever. Killing all the Unicorns and
downgrading to returns peace to the forest.

Here are the before_fork and after_fork from my config/unicorn.rb:
http://codepad.org/5LyVtyq7

Did something change with the Unicorn master in 0.97.0 that would
require a change in my config, or is this a bug?

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


^ permalink raw reply	[relevance 6%]

Results 1-6 of 6 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2010-03-17  9:51  6% Unicorn 0.97.0 old master is never dying ghazel
2010-03-18  8:40  0% ` Eric Wong
2010-03-18 16:35  0%   ` ghazel
2010-03-19  8:23  0%     ` Eric Wong
     [not found]     <CAHOTMV++otgxdru_oZLXuVuqHF7F4uMwd04O0QZBjxeqFR-=XQ@mail.gmail.com>
2012-11-29 23:05     ` Fwd: Maintaining capacity during deploys Tony Arcieri
2012-11-29 23:09  6%   ` Alex Sharp
2014-04-26  3:20     [PATCH] tests: switch to minitest Ken Dreyer
2014-04-26  6:07  7% ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).