unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Does the the environment is preserved on USR2?
@ 2015-06-26 22:18 Bráulio Bhavamitra
  2015-06-26 22:31 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Bráulio Bhavamitra @ 2015-06-26 22:18 UTC (permalink / raw)
  To: unicorn-public

Hello,

I use the ruby environment variable RUBY_GC_MALLOC_LIMIT='90000000' to
start unicorn inside a init.d service and I get the impression that
when I run kill -USR2 `cat tmp/pids/unicorn.pid` in another shell this
variable is no longer used.

So the new master started by USR2 preserve the environment from the
old master or the environment variables need be set on the shell it is
invoked?

cheers,
bráulio

-- 
"Lute pela sua ideologia. Seja um com sua ideologia. Viva pela sua
ideologia. Morra por sua ideologia" P.R. Sarkar

EITA - Educação, Informação e Tecnologias para Autogestão
http://cirandas.net/brauliobo
http://eita.org.br

"Paramapurusha é meu pai e Parama Prakriti é minha mãe. O universo é
meu lar e todos nós somos cidadãos deste cosmo. Este universo é a
imaginação da Mente Macrocósmica, e todas as entidades estão sendo
criadas, preservadas e destruídas nas fases de extroversão e
introversão do fluxo imaginativo cósmico. No âmbito pessoal, quando
uma pessoa imagina algo em sua mente, naquele momento, essa pessoa é a
única proprietária daquilo que ela imagina, e ninguém mais. Quando um
ser humano criado mentalmente caminha por um milharal também
imaginado, a pessoa imaginada não é a propriedade desse milharal, pois
ele pertence ao indivíduo que o está imaginando. Este universo foi
criado na imaginação de Brahma, a Entidade Suprema, por isso a
propriedade deste universo é de Brahma, e não dos microcosmos que
também foram criados pela imaginação de Brahma. Nenhuma propriedade
deste mundo, mutável ou imutável, pertence a um indivíduo em
particular; tudo é o patrimônio comum de todos."
Restante do texto em
http://cirandas.net/brauliobo/blog/a-problematica-de-hoje-em-dia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does the the environment is preserved on USR2?
  2015-06-26 22:18 Does the the environment is preserved on USR2? Bráulio Bhavamitra
@ 2015-06-26 22:31 ` Eric Wong
  2015-06-26 23:14   ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2015-06-26 22:31 UTC (permalink / raw)
  To: Bráulio Bhavamitra; +Cc: unicorn-public

USR2 should not change environment variables besides UNICORN_FD
and PWD (if working_directory is used).

On most Linux versions, you can check the initial environment of a
running process by inspecting the environ file for the process:

	tr '\0' '\n' < /proc/$PID/environ

This may not reflect environment changes after the process is started.

However, you can use ENV inside Ruby code to check that.  Maybe add a
private Rack endpoint to show ENV.inspect output to your app to check
this...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does the the environment is preserved on USR2?
  2015-06-26 22:31 ` Eric Wong
@ 2015-06-26 23:14   ` Eric Wong
  2015-06-26 23:38     ` Bráulio Bhavamitra
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2015-06-26 23:14 UTC (permalink / raw)
  To: Bráulio Bhavamitra; +Cc: unicorn-public

Eric Wong <e@80x24.org> wrote:
> USR2 should not change environment variables besides UNICORN_FD
> and PWD (if working_directory is used).
> 
> On most Linux versions, you can check the initial environment of a
> running process by inspecting the environ file for the process:
> 
> 	tr '\0' '\n' < /proc/$PID/environ
> 
> This may not reflect environment changes after the process is started.

Actually, I noticed this doesn't even reflect ENV changes on
fork from Ruby (but system("env") displays the correct result
from a forked process) using Linux 4.0.6

> However, you can use ENV inside Ruby code to check that.  Maybe add a
> private Rack endpoint to show ENV.inspect output to your app to check
> this...

So use ENV from Ruby instead :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does the the environment is preserved on USR2?
  2015-06-26 23:14   ` Eric Wong
@ 2015-06-26 23:38     ` Bráulio Bhavamitra
  0 siblings, 0 replies; 4+ messages in thread
From: Bráulio Bhavamitra @ 2015-06-26 23:38 UTC (permalink / raw)
  To: Eric Wong; +Cc: unicorn-public

On Fri, Jun 26, 2015 at 8:14 PM, Eric Wong <e@80x24.org> wrote:
> Eric Wong <e@80x24.org> wrote:
>> USR2 should not change environment variables besides UNICORN_FD
>> and PWD (if working_directory is used).
>>
>> On most Linux versions, you can check the initial environment of a
>> running process by inspecting the environ file for the process:
>>
>>       tr '\0' '\n' < /proc/$PID/environ
>>
>> This may not reflect environment changes after the process is started.
>
> Actually, I noticed this doesn't even reflect ENV changes on
> fork from Ruby (but system("env") displays the correct result
> from a forked process) using Linux 4.0.6
>
>> However, you can use ENV inside Ruby code to check that.  Maybe add a
>> private Rack endpoint to show ENV.inspect output to your app to check
>> this...
>
> So use ENV from Ruby instead :)

Thanks Eric, will try this!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-26 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 22:18 Does the the environment is preserved on USR2? Bráulio Bhavamitra
2015-06-26 22:31 ` Eric Wong
2015-06-26 23:14   ` Eric Wong
2015-06-26 23:38     ` Bráulio Bhavamitra

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

	../../../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).