Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 54906 - jabber init script doesn't delete old pid files, causing silent startup failure
Summary: jabber init script doesn't delete old pid files, causing silent startup failure
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Net-im project
URL:
Whiteboard:
Keywords:
: 56089 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-23 10:21 UTC by Eric Johanson
Modified: 2004-07-08 17:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
jabber.rc6-r7 (jabber.rc6-r7,1.77 KB, text/plain)
2004-06-23 12:38 UTC, Gustavo Felisberto (RETIRED)
Details
jabber.rc6-r7 (jabber.rc6-r7,1.81 KB, text/plain)
2004-07-05 09:50 UTC, Gustavo Felisberto (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Johanson 2004-06-23 10:21:29 UTC
If the jabberd server dies for whatever reason (this has happened twice to me), it will not cleanup it's own pid files in /var/spool/jabber/jabber.pid.  With the current gentoo startup/init scripts, this creates a situation where the init script 'claims' jabber started up A-ok, when in fact, it aborted [crashed] right on startup. 

This, in turn, causes the `jabberd stop` to report an errror (jabberd, no process killed). 

Under this setup, jabber doesn't seem to be creating any log files what-so-ever.  It took some poking to find out that it's the old pid file that's creating the problem. 

Steps to reproduce:

`echo 12345 > /var/spool/jabber/jabber.pid`
`/etc/init.d/jabberd start`

Proposed fix:

Have the gentoo startup scripts check for dead pid files in the jabber spool directory, so us un-educated admins don't waste 20 minutes scratching our heads. :)

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Gustavo Felisberto (RETIRED) gentoo-dev 2004-06-23 12:21:42 UTC
What version are you running?
I am taking a look at this is 1.4.3-r3 because i am fealling some problems with the way transports handle their pid files
Comment 2 Gustavo Felisberto (RETIRED) gentoo-dev 2004-06-23 12:38:54 UTC
Created attachment 33970 [details]
jabber.rc6-r7

Please try this version.
Attention that you need to add:
JPIDFILE="/var/log/jabber/jabberd14.pid"

to /etc/confd/jabber
.
Please report. I think that this is going to have to be done for all
transports, because they have strange ways to handle pid files.
Comment 3 Gustavo Felisberto (RETIRED) gentoo-dev 2004-07-04 19:06:48 UTC
*** Bug 56089 has been marked as a duplicate of this bug. ***
Comment 4 Gustavo Felisberto (RETIRED) gentoo-dev 2004-07-04 19:34:08 UTC
Some of the transports don't use the pid file properly, jabberd 1.4 does. So we can relly on the if [ -z $(ps ax | grep `cat ${JPIDFILE}` | grep -v grep ) to see if it is running ok. Even with the error it should start because:
if [ -z $(ps ax | grep `cat ${JPIDFILE}` | grep -v grep ) ]
then
   rm -f ${JPIDFILE}
fi
jabberd -B -c /etc/jabber/multiple.xml >/dev/null 2>&1
It just uses the if to see if there is a dead jabberd with an open file, if there is no file it just gives that error and starts jabberd
But than error message can be fixed. It is 3.30 am, tomorow I will send an updated version.
Comment 5 Alan 2004-07-05 09:14:49 UTC
The only problem with this:

if [ -z $(ps ax | grep `cat ${JPIDFILE}` | grep -v grep ) ]
then
   rm -f ${JPIDFILE}
fi

Is that if ${JPIDFILE} doesn't exist already, the if statement spits out some shell errors because the script is interpreted as 

if [ -z $(ps ax | grep  | grep -v grep ) ]

which of course is not valid because grep needs arguments.

Wrapping the if in an 'if [ -e ${JPIDFILE} ]; then ' or even just changing the line to 

if [ -e ${JPIDFILE} -a -z $(ps ax | grep `cat ${JPIDFILE}` | grep -v grep ) ]

(add a check for ${JPIDFILE} existing AND it's running).  I think that'd work anyway :)
Comment 6 Gustavo Felisberto (RETIRED) gentoo-dev 2004-07-05 09:50:45 UTC
Created attachment 34819 [details]
jabber.rc6-r7

Well i think this wrapps it up for this. It would be nice to re-write the other
inits BUT there needs to be cheked one by one if they really honor their pid
file.
Comment 7 Gustavo Felisberto (RETIRED) gentoo-dev 2004-07-08 17:37:20 UTC
fixed in r3