* [ANN] unicorn 5.3.0 - Rack HTTP server for fast clients and Unix
@ 2017-04-01 8:08 9% Eric Wong
0 siblings, 0 replies; 8+ results
From: Eric Wong @ 2017-04-01 8:08 UTC (permalink / raw)
To: ruby-talk, unicorn-public
Cc: Jeremy Evans, Simon Eskildsen, Dylan Thacker-Smith
unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels. Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.
* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
Changes:
unicorn 5.3.0
A couple of portability fixes from Dylan Thacker-Smith and
Jeremy Evans since 5.3.0.pre1 over a week ago, but this looks
ready for a stable release, today.
When I started this over 8 years ago, I wondered if this would
just end up being an April Fools' joke. Guess not. I guess I
somehow tricked people into using a terribly marketed web server
that cannot talk directly to untrusted clients :x Anyways,
unicorn won't be able to handle slow clients 8 years from now,
either, or 80 years from now. And I vow never to learn to use
new-fangled things like epoll, kqueue, or threads :P
Anyways, this is a largish release with several new features,
and no backwards incompatibilities.
Simon Eskildsen contributed heavily using TCP_INFO under Linux
to implement the (now 5 year old) check_client_connection feature:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170401&x=t
This also led to FreeBSD and OpenBSD portability improvements in
one of our dependencies, raindrops:
https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u
Jeremy Evans contributed several new features. First he
implemented after_worker_exit to aid debugging:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170401&x=t#t
And then security-related features to isolate workers. Workers
may now chroot to drop access to the master filesystem, and the
new after_worker_ready configuration hook now exists to aid with
chroot support in workers:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170401&x=t#t
https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170401&x=t#t
Additionally, workers may run in a completely different VM space
(nullifying preload_app and any CoW savings) with the new
worker_exec option:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170401&x=t#t
There are also several improvements to FreeBSD and OpenBSD
support with the addition of these features.
shortlog of changes since v5.2.0 (2016-10-31):
Dylan Thacker-Smith (1):
Check for Socket::TCP_INFO constant before trying to get TCP_INFO
Eric Wong (30):
drop rb_str_set_len compatibility replacement
TUNING: document THP caveat for Linux users
tee_input: simplify condition for IO#write
remove response_start_sent
http_request: freeze constant strings passed IO#write
Revert "remove response_start_sent"
t/t0012-reload-empty-config.sh: access ivars directly if needed
t0011-active-unix-socket.sh: fix race condition in test
new test for check_client_connection
revert signature change to HttpServer#process_client
support "struct tcp_info" on non-Linux and Ruby 2.2+
unicorn_http: reduce rb_global_variable calls
oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
http_request: reduce insn size for check_client_connection
freebsd: avoid EINVAL when setting accept filter
test-lib: expr(1) portability fix
tests: keep disabled tests defined
test_exec: SO_KEEPALIVE value only needs to be true
doc: fix links to raindrops project
http_request: support proposed Raindrops::TCP states on non-Linux
ISSUES: expand on mail archive info + subscription disclaimer
test_ccc: use a pipe to synchronize test
doc: remove private email support address
input: update documentation and hide internals.
http_server: initialize @pid ivar
gemspec: remove olddoc from build dependency
doc: add version annotations for new features
unicorn 5.3.0.pre1
doc: note after_worker_exit is also 5.3.0+
test_exec: SO_KEEPALIVE value only needs to be true (take #2)
Jeremy Evans (7):
Add after_worker_exit configuration option
Fix code example in after_worker_exit documentation
Add support for chroot to Worker#user
Add after_worker_ready configuration option
Add worker_exec configuration option
Don't pass a block for fork when forking workers
Check for SocketError on first ccc attempt
Simon Eskildsen (1):
check_client_connection: use tcp state on linux
--
Yes, this release is real despite the date.
^ permalink raw reply [relevance 9%]
* [ANN] unicorn 5.3.0.pre1 - Rack HTTP server for fast clients and Unix
@ 2017-03-24 0:28 9% Eric Wong
0 siblings, 0 replies; 8+ results
From: Eric Wong @ 2017-03-24 0:28 UTC (permalink / raw)
To: ruby-talk, unicorn-public; +Cc: Jeremy Evans, Simon Eskildsen
unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels. Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between unicorn and slow clients.
* https://bogomips.org/unicorn/
* public list: unicorn-public@bogomips.org
* mail archives: https://bogomips.org/unicorn-public/
* git clone git://bogomips.org/unicorn.git
* https://bogomips.org/unicorn/NEWS.atom.xml
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
This is a pre-release RubyGem intended for testing.
Changes:
unicorn 5.3.0.pre1
A largish release with several new features.
Simon Eskildsen contributed heavily using TCP_INFO under Linux
to implement the (now 5 year old) check_client_connection feature:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170324&x=t
This also led to FreeBSD and OpenBSD portability improvements in
one of our dependencies, raindrops:
https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u
Jeremy Evans contributed several new features. First he
implemented after_worker_exit to aid debugging:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170324&x=t#t
And then security-related features to isolate workers. Workers
may now chroot to drop access to the master filesystem, and the
new after_worker_ready configuration hook now exists to aid with
chroot support in workers:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170324&x=t#t
https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170324&x=t#t
Additionally, workers may run in a completely different VM space
(nullifying preload_app and any CoW savings) with the new
worker_exec option:
https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170324&x=t#t
There are also several improvements to FreeBSD and OpenBSD
support with the addition of these features.
34 changes since 5.2.0 (2016-10-31):
Eric Wong (27):
drop rb_str_set_len compatibility replacement
TUNING: document THP caveat for Linux users
tee_input: simplify condition for IO#write
remove response_start_sent
http_request: freeze constant strings passed IO#write
Revert "remove response_start_sent"
t/t0012-reload-empty-config.sh: access ivars directly if needed
t0011-active-unix-socket.sh: fix race condition in test
new test for check_client_connection
revert signature change to HttpServer#process_client
support "struct tcp_info" on non-Linux and Ruby 2.2+
unicorn_http: reduce rb_global_variable calls
oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
http_request: reduce insn size for check_client_connection
freebsd: avoid EINVAL when setting accept filter
test-lib: expr(1) portability fix
tests: keep disabled tests defined
test_exec: SO_KEEPALIVE value only needs to be true
doc: fix links to raindrops project
http_request: support proposed Raindrops::TCP states on non-Linux
ISSUES: expand on mail archive info + subscription disclaimer
test_ccc: use a pipe to synchronize test
doc: remove private email support address
input: update documentation and hide internals.
http_server: initialize @pid ivar
gemspec: remove olddoc from build dependency
doc: add version annotations for new features
Jeremy Evans (6):
Add after_worker_exit configuration option
Fix code example in after_worker_exit documentation
Add support for chroot to Worker#user
Add after_worker_ready configuration option
Add worker_exec configuration option
Don't pass a block for fork when forking workers
Simon Eskildsen (1):
check_client_connection: use tcp state on linux
--
5.3.0 in a week, maybe?
^ permalink raw reply [relevance 9%]
* Re: Patch: Add after_worker_exit configuration option
2017-02-21 20:49 14% ` Jeremy Evans
@ 2017-02-21 21:38 9% ` Eric Wong
0 siblings, 0 replies; 8+ results
From: Eric Wong @ 2017-02-21 21:38 UTC (permalink / raw)
To: Jeremy Evans; +Cc: unicorn-public
Jeremy Evans <code@jeremyevans.net> wrote:
> Here's a revised patch that should address the issues you identified:
Thanks. Pushed as 2af91a1fef70d6546ee03760011c170a082db667
I needed one change to an integration test to workaround
the lack of reader attribute, but I'd rather pay the cost
in the test than the server, itself:
https://bogomips.org/unicorn.git/patch?id=2c6aa5878d052abb
("t/t0012-reload-empty-config.sh: access ivars directly if needed")
^ permalink raw reply [relevance 9%]
* Re: Patch: Add after_worker_exit configuration option
2017-02-21 20:15 9% ` Eric Wong
@ 2017-02-21 20:49 14% ` Jeremy Evans
2017-02-21 21:38 9% ` Eric Wong
0 siblings, 1 reply; 8+ results
From: Jeremy Evans @ 2017-02-21 20:49 UTC (permalink / raw)
To: Eric Wong; +Cc: unicorn-public
On 02/21 08:15, Eric Wong wrote:
> Jeremy Evans <code@jeremyevans.net> wrote:
> > On 02/21 07:43, Eric Wong wrote:
> > > Jeremy Evans <code@jeremyevans.net> wrote:
> > > > This option can be used to implement custom behavior for handling
> > > > worker exits. For example, let's say you have a specific request
> > > > that crashes a worker process, which you expect to be due to a
> > > > improperly programmed C extension. By modifying your worker to
> > > > save request related data in a temporary file and using this option,
> > > > you can get a record of what request is crashing the application,
> > > > which will make debugging easier.
> > > >
> > > > This is not a complete patch as it doesn't include tests, but
> > > > before writing tests I wanted to see if this is something you'd
> > > > consider including in unicorn.
> > >
> > > What advantage does this have over Ruby's builtin at_exit?
> >
> > at_exit is not called if the interpreter crashes:
> >
> > ruby -e 'at_exit{File.write('a.txt', 'a')}; Process.kill :SEGV, $$' 2>/dev/null
> > ([ -f a.txt ] && echo at_exit called) || echo at_exit not called
>
> Ah, thanks. I didn't read the code carefully, enough.
> The commit message and documentation should reflect that it's
> called in the master and not the worker.
>
> Anyways, this is probably OK since I can't think of a less
> intrusive or more generic (across all Rack servers) way of doing
> it. So I'm inclined to accept some version of this.
>
> > --- a/lib/unicorn/http_server.rb
> > +++ b/lib/unicorn/http_server.rb
> > @@ -14,7 +14,8 @@ class Unicorn::HttpServer
> > attr_accessor :app, :timeout, :worker_processes,
> > :before_fork, :after_fork, :before_exec,
> > :listener_opts, :preload_app,
> > - :orig_app, :config, :ready_pipe, :user
> > + :orig_app, :config, :ready_pipe, :user,
> > + :after_worker_exit
>
> I've been trying to reduce the method entry overhead across
> the board. Since this is a new field, can it be attr_writer
> solely for configurator?
>
> I don't think there's reader dependency other than below...
>
> > @@ -395,8 +396,7 @@ def reap_all_workers
> > proc_name 'master'
> > else
> > worker = @workers.delete(wpid) and worker.close rescue nil
> > - m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
> > - status.success? ? logger.info(m) : logger.error(m)
> > + after_worker_exit.call(self, worker, status)
>
> Which can be made to access the ivar directly:
>
> @after_worker_exit.call(self, worker, status)
Here's a revised patch that should address the issues you identified:
From 91b95652e4bdb7fc9af77e9ac06ad7400faef796 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@jeremyevans.net>
Date: Fri, 17 Feb 2017 16:12:33 -0800
Subject: [PATCH] Add after_worker_exit configuration option
This option is executed in the master process following all
worker process exits. It is most useful in the case where
the worker process crashes the ruby interpreter, as the worker
process may not be able to send error notifications
appropriately.
For example, let's say you have a specific request that crashes a
worker process, which you expect to be due to a improperly
programmed C extension. By modifying your worker to save request
related data in a temporary file and using this option, you can get
a record of what request is crashing the application, which will
make debugging easier.
Example:
after_worker_exit do |server, worker, status|
server.logger.info "worker #{status.success? ? 'exit' : 'crash'}: #{status}"
file = "request.#{status.pid}.txt"
if File.exist?(file)
do_something_with(File.read(file)) unless status.success?
File.delete(file)
end
end
---
lib/unicorn/configurator.rb | 21 +++++++++++++++++++++
lib/unicorn/http_server.rb | 4 ++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 3329c10..5bad925 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -41,6 +41,14 @@ class Unicorn::Configurator
:before_exec => lambda { |server|
server.logger.info("forked child re-executing...")
},
+ :after_worker_exit => lambda { |server, worker, status|
+ m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
+ if status.success?
+ server.logger.info(m)
+ else
+ server.logger.error(m)
+ end
+ },
:pid => nil,
:preload_app => false,
:check_client_connection => false,
@@ -151,6 +159,19 @@ def after_fork(*args, &block)
set_hook(:after_fork, block_given? ? block : args[0])
end
+ # sets after_worker_exit hook to a given block. This block will be called
+ # by the master process after a worker exits:
+ #
+ # after_fork do |server,worker,status|
+ # # status is a Process::Status instance for the exited worker process
+ # unless status.success?
+ # server.logger.error("worker process failure: #{status.inspect}")
+ # end
+ # end
+ def after_worker_exit(*args, &block)
+ set_hook(:after_worker_exit, block_given? ? block : args[0], 3)
+ end
+
# sets before_fork got be a given Proc object. This Proc
# object will be called by the master process before forking
# each worker.
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 35bd100..c2086cb 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -15,6 +15,7 @@ class Unicorn::HttpServer
:before_fork, :after_fork, :before_exec,
:listener_opts, :preload_app,
:orig_app, :config, :ready_pipe, :user
+ attr_writer :after_worker_exit
attr_reader :pid, :logger
include Unicorn::SocketHelper
@@ -395,8 +396,7 @@ def reap_all_workers
proc_name 'master'
else
worker = @workers.delete(wpid) and worker.close rescue nil
- m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
- status.success? ? logger.info(m) : logger.error(m)
+ @after_worker_exit.call(self, worker, status)
end
rescue Errno::ECHILD
break
--
2.11.0
^ permalink raw reply related [relevance 14%]
* Re: Patch: Add after_worker_exit configuration option
2017-02-21 20:02 9% ` Jeremy Evans
@ 2017-02-21 20:15 9% ` Eric Wong
2017-02-21 20:49 14% ` Jeremy Evans
0 siblings, 1 reply; 8+ results
From: Eric Wong @ 2017-02-21 20:15 UTC (permalink / raw)
To: Jeremy Evans; +Cc: unicorn-public
Jeremy Evans <code@jeremyevans.net> wrote:
> On 02/21 07:43, Eric Wong wrote:
> > Jeremy Evans <code@jeremyevans.net> wrote:
> > > This option can be used to implement custom behavior for handling
> > > worker exits. For example, let's say you have a specific request
> > > that crashes a worker process, which you expect to be due to a
> > > improperly programmed C extension. By modifying your worker to
> > > save request related data in a temporary file and using this option,
> > > you can get a record of what request is crashing the application,
> > > which will make debugging easier.
> > >
> > > This is not a complete patch as it doesn't include tests, but
> > > before writing tests I wanted to see if this is something you'd
> > > consider including in unicorn.
> >
> > What advantage does this have over Ruby's builtin at_exit?
>
> at_exit is not called if the interpreter crashes:
>
> ruby -e 'at_exit{File.write('a.txt', 'a')}; Process.kill :SEGV, $$' 2>/dev/null
> ([ -f a.txt ] && echo at_exit called) || echo at_exit not called
Ah, thanks. I didn't read the code carefully, enough.
The commit message and documentation should reflect that it's
called in the master and not the worker.
Anyways, this is probably OK since I can't think of a less
intrusive or more generic (across all Rack servers) way of doing
it. So I'm inclined to accept some version of this.
> --- a/lib/unicorn/http_server.rb
> +++ b/lib/unicorn/http_server.rb
> @@ -14,7 +14,8 @@ class Unicorn::HttpServer
> attr_accessor :app, :timeout, :worker_processes,
> :before_fork, :after_fork, :before_exec,
> :listener_opts, :preload_app,
> - :orig_app, :config, :ready_pipe, :user
> + :orig_app, :config, :ready_pipe, :user,
> + :after_worker_exit
I've been trying to reduce the method entry overhead across
the board. Since this is a new field, can it be attr_writer
solely for configurator?
I don't think there's reader dependency other than below...
> @@ -395,8 +396,7 @@ def reap_all_workers
> proc_name 'master'
> else
> worker = @workers.delete(wpid) and worker.close rescue nil
> - m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
> - status.success? ? logger.info(m) : logger.error(m)
> + after_worker_exit.call(self, worker, status)
Which can be made to access the ivar directly:
@after_worker_exit.call(self, worker, status)
^ permalink raw reply [relevance 9%]
* Re: Patch: Add after_worker_exit configuration option
2017-02-21 19:43 9% ` Eric Wong
@ 2017-02-21 20:02 9% ` Jeremy Evans
2017-02-21 20:15 9% ` Eric Wong
0 siblings, 1 reply; 8+ results
From: Jeremy Evans @ 2017-02-21 20:02 UTC (permalink / raw)
To: Eric Wong; +Cc: unicorn-public
On 02/21 07:43, Eric Wong wrote:
> Jeremy Evans <code@jeremyevans.net> wrote:
> > This option can be used to implement custom behavior for handling
> > worker exits. For example, let's say you have a specific request
> > that crashes a worker process, which you expect to be due to a
> > improperly programmed C extension. By modifying your worker to
> > save request related data in a temporary file and using this option,
> > you can get a record of what request is crashing the application,
> > which will make debugging easier.
> >
> > This is not a complete patch as it doesn't include tests, but
> > before writing tests I wanted to see if this is something you'd
> > consider including in unicorn.
>
> What advantage does this have over Ruby's builtin at_exit?
at_exit is not called if the interpreter crashes:
ruby -e 'at_exit{File.write('a.txt', 'a')}; Process.kill :SEGV, $$' 2>/dev/null
([ -f a.txt ] && echo at_exit called) || echo at_exit not called
>
> AFAIK, at_exit may be registered inside after_fork hooks to the
> same effect.
>
> Thanks.
^ permalink raw reply [relevance 9%]
* Re: Patch: Add after_worker_exit configuration option
2017-02-21 19:19 7% Patch: Add after_worker_exit configuration option Jeremy Evans
@ 2017-02-21 19:43 9% ` Eric Wong
2017-02-21 20:02 9% ` Jeremy Evans
0 siblings, 1 reply; 8+ results
From: Eric Wong @ 2017-02-21 19:43 UTC (permalink / raw)
To: Jeremy Evans; +Cc: unicorn-public
Jeremy Evans <code@jeremyevans.net> wrote:
> This option can be used to implement custom behavior for handling
> worker exits. For example, let's say you have a specific request
> that crashes a worker process, which you expect to be due to a
> improperly programmed C extension. By modifying your worker to
> save request related data in a temporary file and using this option,
> you can get a record of what request is crashing the application,
> which will make debugging easier.
>
> This is not a complete patch as it doesn't include tests, but
> before writing tests I wanted to see if this is something you'd
> consider including in unicorn.
What advantage does this have over Ruby's builtin at_exit?
AFAIK, at_exit may be registered inside after_fork hooks to the
same effect.
Thanks.
^ permalink raw reply [relevance 9%]
* Patch: Add after_worker_exit configuration option
@ 2017-02-21 19:19 7% Jeremy Evans
2017-02-21 19:43 9% ` Eric Wong
0 siblings, 1 reply; 8+ results
From: Jeremy Evans @ 2017-02-21 19:19 UTC (permalink / raw)
To: unicorn-public
This option can be used to implement custom behavior for handling
worker exits. For example, let's say you have a specific request
that crashes a worker process, which you expect to be due to a
improperly programmed C extension. By modifying your worker to
save request related data in a temporary file and using this option,
you can get a record of what request is crashing the application,
which will make debugging easier.
This is not a complete patch as it doesn't include tests, but
before writing tests I wanted to see if this is something you'd
consider including in unicorn.
Example:
after_worker_exit do |server, worker, status|
server.logger.info "worker #{status.success? ? 'exit' : 'crash'}: #{status}"
file = "request.#{status.pid}.txt"
if File.exist?(file)
do_something_with(File.read(file)) unless status.success?
File.delete(file)
end
end
---
lib/unicorn/configurator.rb | 14 ++++++++++++++
lib/unicorn/http_server.rb | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 3329c10..81589b0 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -41,6 +41,14 @@ class Unicorn::Configurator
:before_exec => lambda { |server|
server.logger.info("forked child re-executing...")
},
+ :after_worker_exit => lambda { |server, worker, status|
+ m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
+ if status.success?
+ server.logger.info(m)
+ else
+ server.logger.error(m)
+ end
+ },
:pid => nil,
:preload_app => false,
:check_client_connection => false,
@@ -151,6 +159,12 @@ def after_fork(*args, &block)
set_hook(:after_fork, block_given? ? block : args[0])
end
+ # sets after_worker_exit hook to a given block. This block will be called
+ # by the master process after a worker exits.
+ def after_worker_exit(*args, &block)
+ set_hook(:after_worker_exit, block_given? ? block : args[0], 3)
+ end
+
# sets before_fork got be a given Proc object. This Proc
# object will be called by the master process before forking
# each worker.
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 35bd100..567ee0e 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -14,7 +14,8 @@ class Unicorn::HttpServer
attr_accessor :app, :timeout, :worker_processes,
:before_fork, :after_fork, :before_exec,
:listener_opts, :preload_app,
- :orig_app, :config, :ready_pipe, :user
+ :orig_app, :config, :ready_pipe, :user,
+ :after_worker_exit
attr_reader :pid, :logger
include Unicorn::SocketHelper
@@ -395,8 +396,7 @@ def reap_all_workers
proc_name 'master'
else
worker = @workers.delete(wpid) and worker.close rescue nil
- m = "reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}"
- status.success? ? logger.info(m) : logger.error(m)
+ after_worker_exit.call(self, worker, status)
end
rescue Errno::ECHILD
break
--
2.11.0
^ permalink raw reply related [relevance 7%]
Results 1-8 of 8 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-02-21 19:19 7% Patch: Add after_worker_exit configuration option Jeremy Evans
2017-02-21 19:43 9% ` Eric Wong
2017-02-21 20:02 9% ` Jeremy Evans
2017-02-21 20:15 9% ` Eric Wong
2017-02-21 20:49 14% ` Jeremy Evans
2017-02-21 21:38 9% ` Eric Wong
2017-03-24 0:28 9% [ANN] unicorn 5.3.0.pre1 - Rack HTTP server for fast clients and Unix Eric Wong
2017-04-01 8:08 9% [ANN] unicorn 5.3.0 " 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).