Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 418461 - net-im/bitlbee initscript should check pidfile
Summary: net-im/bitlbee initscript should check pidfile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alex Alexander (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-31 23:45 UTC by Jan Hruban
Modified: 2014-10-07 07:11 UTC (History)
2 users (show)

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


Attachments
initscript patch (file_418461.txt,397 bytes, text/plain)
2012-05-31 23:53 UTC, Jan Hruban
Details
/etc/init.d/bitlbee patch (file_418461.txt,635 bytes, text/plain)
2012-09-02 19:43 UTC, Xenith
Details
Patch to fix pidfile usage (file_418461.txt,554 bytes, patch)
2014-09-11 15:51 UTC, Nathan Mahon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hruban 2012-05-31 23:45:39 UTC
net-im/bitlbee-3.0.5-r1
When running bitlbee in daemon mode and restarting bitlbee via initscript, it fails to restart with:
"start-stop-daemon: /usr/sbin/bitlbee is already running"

Bitlbee can fork many processes and start-stop-daemon does not check against pid file, but rather does process name comparsion.

Some background:
Bitlbee forks process for each connected client and upon stop, bitlbee does not kill those children to not cut off connections. This is used for upgrade, so new clients get connected to upgraded bitlbee while already connected clients retain the old connections.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/bitlbee start
2. connect some irc clients to bitlbee
3. /etc/init.d/bitlbee restarat

Actual Results:  
# /etc/init.d/bitlbee restart

 * Caching service dependencies ...                                                          [ ok ]
 * Stopping bitlbee ...                                                                      [ ok ]
 * Starting bitlbee ...
 * start-stop-daemon: /usr/sbin/bitlbee is already running                                   [ !! ]
 * ERROR: bitlbee failed to start


Expected Results:  
restart bitlbee
Comment 1 Jan Hruban 2012-05-31 23:53:16 UTC
Created attachment 313771 [details]
initscript patch
Comment 2 Wormo (RETIRED) gentoo-dev 2012-06-01 07:17:49 UTC
Thanks for submitting this initscript fix, assigning to maintainers
Comment 3 Xenith 2012-09-02 19:18:50 UTC
This problem hasn't been resolved for me. start-stop-daemon still fails to kill the process with ESTABLISHED tcp connections. 

I've noticed it forks child processes regardless of whether or not Daemon or ForkDaemon is set in the config.
Comment 4 Xenith 2012-09-02 19:43:13 UTC
Created attachment 322774 [details]
/etc/init.d/bitlbee patch
Comment 5 Xenith 2012-09-02 19:44:59 UTC
Since bitlbee creates the user and group bitlbee:bitlbee on install, I've found that using user-based termination with start-stop-daemon yielded better results. YMMV.
Comment 6 Nathan Mahon 2014-08-25 18:58:17 UTC
The pid file isn't being generated on my system,(In reply to Xenith from comment #5)
> Since bitlbee creates the user and group bitlbee:bitlbee on install, I've
> found that using user-based termination with start-stop-daemon yielded
> better results. YMMV.

That'd kill off all children, all active sessions.  Unnecessarily, imho.
Comment 7 Nathan Mahon 2014-09-11 15:51:37 UTC
Created attachment 384580 [details, diff]
Patch to fix pidfile usage

This fix fixes the pidfile usage, and doesn't unnecessarily kill live sessions (children) during a restart.
Comment 8 Alex Alexander (RETIRED) gentoo-dev 2014-10-07 07:11:45 UTC
This is fixed in bitlbee-3.2.1-r1.
I used Xenith's user-based termination.
This is what I'd expect the init script to do, anyway.

Many thanks.

/etc/init.d/bitlbee restart
 * Stopping bitlbee ... [ ok ]
 * Starting bitlbee ... [ ok ]

:)