lenya-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Frovarp <richard.frov...@sendit.nodak.edu>
Subject Re: [1.2] lenya.sh stores PID?
Date Wed, 06 Feb 2008 19:34:55 GMT
solprovider@apache.org wrote:
> On 2/6/08, Jörn Nettingsmeier <nettings@apache.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.

To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org

View raw message