search for: after_fork

Displaying 20 results from an estimated 59 matches for "after_fork".

2020 Jun 22
4
[PATCH nbdkit 1/2] server: Add .after_fork callback, mainly for plugins to create threads.
...se in .get_ready (or earlier). The reason is that nbdkit forks when either daemonizing itself or using the --run option, and fork cancels all the background threads in the child process (the daemonized or captive nbdkit). The only good solution here is to add a new callback which I've called .after_fork which runs after either daemonization or the --run function. It should be used sparingly because it's not possible to report errors nicely from this callback. In particular when daemonizing we have lost the controlling terminal and errors go to syslog - it looks to the user as if nbdkit “died...
2020 Jun 22
0
Re: [PATCH nbdkit 1/2] server: Add .after_fork callback, mainly for plugins to create threads.
...d in the parent process (fork always creates a single-threaded process - you have to use Linux-specific clone to copy threads from parent to child, and it's not worth us trying to go that low-level). > > The only good solution here is to add a new callback which I've called > .after_fork which runs after either daemonization or the --run > function. Yeah, I'm not thinking of any other viable solutions. > > It should be used sparingly because it's not possible to report errors > nicely from this callback. In particular when daemonizing we have > lost the c...
2012 Aug 31
1
after_fork - ActiveRecord::AdapterNotSpecified
Hi all, I''m fighting with the after_fork hook and my sinatra application. The Sinatra app is using active_record, In my unciron.rb file I''m using preload_app true after_fork do |server, worker| ? defined?(ActiveRecord::Base) and ??? ActiveRecord::Base.establish_connection End but I always get the error: ERROR -- : ActiveRecord:...
2012 Jul 19
5
Detecting unicorn / defining after_fork after master startup
...ly checks to see that Unicorn is present, not that you are using it. I know a lot of shops may use Unicorn in production but something else for local development. Is there something equivalent to the IN_PHUSION_PASSENGER constant that passenger defines? 2. Is there an established way for adding an after_fork hook after Unicorn has already started up? I''m aware of the ability to do this via the config file but I don''t want my users to have to add something to their unicorn config file. Is there an equivalent to passenger''s PhusionPassenger.on_event(:starting_worker_process) m...
2013 Jan 20
6
preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr
Greetings, I''m getting this - ActiveModel::MissingAttributeError: missing attribute: some_attr - on a random basis under a unicorn server, running rails 3.2 and ruby 1.9.3 As the case of the last poster in the following thread - https://github.com/rails/rails/issues/1906 - I too am able to resolve this issue by settingpreload_app to false. However, this is not the behaviour I want to
2012 Nov 29
13
Fwd: Maintaining capacity during deploys
We''re using unicornctl restart with the default before/after hook behavior, which is to reap old Unicorn workers via SIGQUIT after the new one has finished booting. Unfortunately, while the new workers are forking and begin processing requests, we''re still seeing significant spikes in our haproxy request queue. It seems as if after we restart, the unwarmed workers get swamped by
2020 Jun 22
0
[PATCH nbdkit 2/2] vddk: Defer library initialization to .after_fork().
...ed in .get_ready that the library is dlopenable. + * + * For various hangs and failures which were caused by background + * threads and fork see: + * https://bugzilla.redhat.com/show_bug.cgi?id=1846309#c9 + * https://www.redhat.com/archives/libguestfs/2019-April/msg00090.html + */ +static int +vddk_after_fork (void) +{ + VixError err; /* Initialize VDDK library. */ DEBUG_CALL ("VixDiskLib_InitEx", @@ -457,10 +476,6 @@ vddk_get_ready (void) return 0; } -#define vddk_config_help \ - "[file=]<FILENAME> (required) The filename (eg. VMDK file) to serve.\n" \ - &qu...
2020 Jun 22
1
Re: [PATCH nbdkit 2/2] vddk: Defer library initialization to .after_fork().
On 6/22/20 10:49 AM, Richard W.M. Jones wrote: > VDDK creates background threads. fork kills these, resulting in the s/kills/strands/ > library hanging or failing completely in certain configurations. > --- > plugins/vddk/vddk.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > ACK. Should we also modify our tests/libvixDiskLib.so
2020 Sep 01
0
[nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...turned by [.extents]. *) +type export = { + name : string; + description : string; +} +(** The type of the export list returned by [.list_exports]. *) + type thread_model = | THREAD_MODEL_SERIALIZE_CONNECTIONS | THREAD_MODEL_SERIALIZE_ALL_REQUESTS @@ -78,10 +84,13 @@ type 'a plugin = { after_fork : (unit -> unit) option; preconnect : (bool -> unit) option; + list_exports : (bool -> bool -> export list) option; + default_export : (bool -> bool -> string) option; open_connection : (bool -> 'a) option; (* required *) close : ('a -> unit) opt...
2020 Sep 21
0
[nbdkit PATCH v3 14/14] ocaml: Implement .list_exports and friends
...by [.extents]. *) +type export = { + name : string; + description : string option; +} +(** The type of the export list returned by [.list_exports]. *) + type thread_model = | THREAD_MODEL_SERIALIZE_CONNECTIONS | THREAD_MODEL_SERIALIZE_ALL_REQUESTS @@ -78,10 +84,13 @@ type 'a plugin = { after_fork : (unit -> unit) option; preconnect : (bool -> unit) option; + list_exports : (bool -> bool -> export list) option; + default_export : (bool -> bool -> string) option; open_connection : (bool -> 'a) option; (* required *) close : ('a -> unit) opt...
2020 Jul 30
3
Re: [PATCH nbdkit v2] PROPOSED: server: Implement list_exports.
...sioning something like the current nbd plugin having a --shared mode; by default (--shared=false), we get: client1 -> nbdkit nbd .open() -> server connection 1 client2 -> nbdkit nbd .open() -> server connection 2 but with --shared=true, we get: client1 -\ > nbdkit nbd .after_fork() -> single server connection client2 -/ We need something similar for a filter to be able to request a single shared .open of the underlying plugin (shared by all connections into the filter), and which has a lifetime visible between the filter's .after_fork and .unload regardless of ho...
2009 Nov 05
0
unicorn 0.94.0 - small fixes and new features
...a "working_directory", symlink-aware detection of the current path no longer depends on /bin/sh so it should work out-of-the-box on FreeBSD and Solaris and not just systems where /bin/sh is dash, ksh93 or bash. User-switching support is finally supported but only intended for use in the after_fork hook of worker processes. Putting it in the after_fork hook allows allows users to set things like CPU affinity[1] on a per-worker basis before dropping privileges. The master process retains all privileges it started with. The ENV["RACK_ENV"] (process-wide) environment variable is now...
2010 Nov 09
2
AMQP and Unicorn (mq gem)
Hi all, I''m having issues with Unicorn and connecting to RabbitMQ using the tmm1-amqp gem. I''ve tried lots of approaches. The classic initializer with Thread.new { EM.run } for the Rails app and even tried using the Qusion library. (https://github.com/danielsdeleo/qusion) I''ve made a simple mod to Qusion for it to monkey patch unicorn too. The code looks
2020 Aug 25
0
[nbdkit PATCH 1/5] api: Add .default_export
...table lifetime that lasts to the corresponding C<.close>, with all intermediate functions (such as C<.pread>) receiving the same value for convenience; the only exceptions where C<nxdata> is not reused are C<.config>, -C<.config_complete>, C<.get_ready>, C<.after_fork>, C<.preconnect> and -C<.list_exports>, which are called outside the lifetime of a -connection. +C<.config_complete>, C<.get_ready>, C<.after_fork>, C<.preconnect>, +C<.list_exports>, and C<.default_export>, which are called outside +the lifetime o...
2020 Aug 02
2
[nbdkit] Failure in test-retry-size.sh
...et_ready nbdkit: debug: calling: /tmp/nbdkitpKY00D/inline-script.sh get_ready nbdkit: debug: completed: /tmp/nbdkitpKY00D/inline-script.sh get_ready: status 2 nbdkit: debug: bound to unix socket /tmp/nbdkitEtiOcF/socket nbdkit: debug: forked into background (new pid = 4095481) nbdkit: debug: retry: after_fork nbdkit: debug: sh: after_fork nbdkit: debug: calling: /tmp/nbdkitpKY00D/inline-script.sh after_fork nbdkit: debug: completed: /tmp/nbdkitpKY00D/inline-script.sh after_fork: status 2 nbdkit: debug: accepted connection nbdkit: sh[1]: debug: retry: preconnect nbdkit: sh[1]: debug: sh: preconnect nbdki...
2013 Apr 25
4
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
2020 Jul 01
0
[PATCH nbdkit 8/9] nbd: Fix shared=true so it creates background thread after fork.
...option that implies this). This is because it creates a background reader thread, but that thread is invalidated if nbdkit forks, resulting in deadlocks because the worker threads are fruitlessly sending notifications to a background thread that no longer exists. The fix is to move this work to .after_fork. --- plugins/nbd/nbd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c index 05f78777..91ed91e0 100644 --- a/plugins/nbd/nbd.c +++ b/plugins/nbd/nbd.c @@ -109,7 +109,7 @@ static void nbdplug_close_handle (struct handle *h); s...
2009 Oct 02
0
[PATCH] configurator: update some migration examples
...= (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU + # Process.kill(sig, File.read(old_pid).to_i) + # rescue Errno::ENOENT, Errno::ESRCH + # end + # + # # optionally throttle the master from forking too quickly by sleeping + # sleep 1 # end # # after_fork do |server, worker| + # # per-process listener ports for debugging/admin/migrations # addr = "127.0.0.1:#{9293 + worker.nr}" # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true) # @@ -50,10 +67,6 @@ module Unicorn :worker_processes =&...
2011 Apr 19
0
unicorn 3.6.0 release soon
...es_ and scale to mythical 4096 core systems :) The PRNG issues are documented in depth here (and links to Ruby Redmine): http://bogomips.org/unicorn.git/commit?id=1107ede7 http://bogomips.org/unicorn.git/commit?id=b3241621 If you''re too lazy to upgrade, you can just do this in your after_fork hooks: after_fork do |server,worker| tmp = srand OpenSSL::Random.seed(tmp.to_s) if defined?(OpenSSL::Random) end There are also small log reopening (SIGUSR1) improvements: * relative paths may also be reopened, there''s a small chance this will break with a handful of setup...
2020 Jul 30
0
Re: [PATCH nbdkit v2] PROPOSED: server: Implement list_exports.
...g ...] On Wed, Jul 29, 2020 at 09:22:31PM -0500, Eric Blake wrote: > We need something similar for a filter to be able to request a > single shared .open of the underlying plugin (shared by all > connections into the filter), and which has a lifetime visible > between the filter's .after_fork and .unload regardless of how many > .open/.prepare/.close client connections come and go, rather than > having to repeat a next_ops->open for each filter .open. Kind of > the opposite of the reopen filter (which uses multiple calls into > next_ops->open from a single .open to th...