List Info

Thread: Re: lenya.sh stores PID?




Re: lenya.sh stores PID?
country flaguser name
Switzerland
2008-02-06 15:15:56
solprovider, Jörn, Richard,

thanks for clarifying! This sounds reasonable.

-- Andreas

Richard Frovarp schrieb:
> solproviderapache.org wrote:
>> On 2/6/08, Jörn Nettingsmeier <nettingsapache.org> wrote:
>>  
>>> Andreas Hartmann wrote:
>>>  > I don't know if this behaviour is
intended:
>>>  > When I start my Lenya 1.2.x, the process
ID seems to be written to a
>>>  > file. Ctrl+C doesn't shutdown Jetty, but
the next ./lenya.sh kills 
>>> the
>>>  > process with the stored ID.
>>>  >
>>>  > Is there any special reason for this
behaviour? IMO storing PIDs is
>>>  > dangerous - on the next day, the ID could
be assigned to another 
>>> process
>>>  > which will be killed when you startup
Lenya ... Or is this not 
>>> possible?
>>> only if you own it. if you run lenya as a
special user (which you really
>>>  really should), then there's no danger at all.
if you run lenya as 
>>> root,
>>>  you get what you deserve 
>>>
>>>  storing PIDs is standard behaviour for daemons
that are singletons.
>>>  check the /var/run directory of most unix
systems for an overview of 
>>> how
>>>  many programs do it...
>>>  Jörn Nettingsmeier
>>>     
>>
>> I stored the PID to add the "stop"
option.  As Jorn states, this is
>> standard *nix behavior.  The PID being stored is
returned from the
>> java command, not the process calling lenya.sh. 
The PID is not stored
>> when starting in "cli" mode to prevent
interfering with a known user
>> process.  To allow hijacking through reuse of the
PID, a user would
>> need to kill the process without using lenya.sh and
find a method to
>> start a new process on that PID.  I thought the OS
always assigns the
>> PID and has enough PID numbers that I have never
seen a rollover.
>>   
> It does assign the PID and they do rollover. There's
only 32K of them, 
> which isn't too many on some systems. My incoming email
systems rollover 
> several times a day, but those are short lived sendmail
and various 
> scanning processes.
> 
>> Can an OS assign a new Java/Jetty/Lenya process a
PID that is already 
>> in use?
>>   
> No, it shouldn't be able to.


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribelenya.apache.org
For additional commands, e-mail: dev-helplenya.apache.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )