Re: Persistence in effect only in case of a crash?

214 views
Skip to first unread message

Keith Rarick

unread,
Nov 20, 2012, 5:32:44 PM11/20/12
to beansta...@googlegroups.com
On Tue, Nov 20, 2012 at 1:49 PM, Ben <googl...@niessen.ch> wrote:
> I started beanstalkd using "-b" to have a binlog created. Now I expected
> that every job which is not yet finished/deleted will be restored after a
> restart of beanstalkd. In fact the jobs will only be recovered if I kill
> beanstalkd via "killall beanstalkd" instead of a clean shutdown.

I'm not sure I understand what you mean by "clean shutdown".
Beanstalkd doesn't distinguish different ways of shutting it down;
it's crash-only.

Can you provide specific steps reproduce the behavior you don't expect?

If you expected "every job which is not yet finished/deleted will be restored",
can you describe what you actually saw? (For example, "after starting,
beanstalkd was empty, with no jobs counted in the stats command
output".)

Ben

unread,
Nov 20, 2012, 5:56:09 PM11/20/12
to beansta...@googlegroups.com
I am running FreeBSD 9 and the following happens:

1. I create a job in a queue called "test".
2. I run /usr/local/etc/rc.d/beanstalkd stop
3. I run /usr/local/etc/rc.d/beanstalkd start
4. The job is gone (no worker who could process the task is online)

Now I do the same but change the way I stop beanstalkd:

1. I create a job in a queue called "test".
2. I run killall beanstalkd
3. I run /usr/local/etc/rc.d/beanstalkd start
4. The job is still in the queue and can be processed

So for me this is a different behavior. I called the stop script "clean".

Why is this different?

Thanks for your reply.

Am Dienstag, 20. November 2012 22:49:00 UTC+1 schrieb Ben:
Hi,

I started beanstalkd using "-b" to have a binlog created. Now I expected that every job which is not yet finished/deleted will be restored after a restart of beanstalkd. In fact the jobs will only be recovered if I kill beanstalkd via "killall beanstalkd" instead of a clean shutdown.

Is this the expected behavior? Wouldn't it make sense to keep the log in any case?

I am running Beanstalkd 1.6.

Thanks for help.

Chad Kouse

unread,
Nov 20, 2012, 8:54:33 PM11/20/12
to beansta...@googlegroups.com
What's in your beanstalkd init script? 

-- 
Chad Kouse
Sent with Sparrow

--
You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/beanstalk-talk/-/_T4CVoKhzLMJ.
To post to this group, send email to beansta...@googlegroups.com.
To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.

Ben

unread,
Nov 21, 2012, 3:14:31 AM11/21/12
to beansta...@googlegroups.com
I don't think it's much of a help as the actual stop command is not present (only poststop):

#!/bin/sh
#
# $FreeBSD: ports/net/beanstalkd/files/beanstalkd.in,v 1.4 2012/02/17 16:49:41 vsevolod Exp $
#
# PROVIDE: beanstalkd
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to run beanstalkd:
#
# beanstalkd_enable (bool): Set it to "YES" to enable beanstalkd.
# Default is "NO".
# beanstalkd_flags (flags): Set extra flags here. More options in beanstalkd(1)
# Default is empty "".
# beanstalkd_user (user): Set user to run beanstalkd.
# Default is "nobody".
# beanstalkd_profiles (str):     Set to "" by default.
#                               Define your profiles here.
. /etc/rc.subr
name="beanstalkd"
rcvar=beanstalkd_enable
_piddir="/var/run/beanstalkd"
pidfile="${_piddir}/beanstalkd.pid"
load_rc_config ${name}
if [ -n "$2" ]; then
profile="$2"
if [ -n "${beanstalkd_profiles}" ]; then
pidfile="${_piddir}/beanstalkd.${profile}.pid"
eval beanstalkd_enable="\${beanstalkd_${profile}_enable:-${beanstalkd_enable}}"
eval beanstalkd_flags="\${beanstalkd_${profile}_flags:-${beanstalkd_flags}}"
else
echo "/usr/local/etc/rc.d/beanstalkd: extra argument ignored"
fi
else
if [ -n "${beanstalkd_profiles}" -a -n "$1" ]; then
for profile in ${beanstalkd_profiles}; do
eval _enable="\${beanstalkd_${profile}_enable}"
case "${_enable:-${beanstalkd_enable}}" in
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
continue
;;
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
;;
*)
if test -z "$_enable"; then
_var=beanstalkd_enable
else
_var=beanstalkd_"${profile}"_enable
fi
warn "Bad value" \
   "'${_enable:-${beanstalkd_enable}}'" \
   "for ${_var}. " \
   "Profile ${profile} skipped."
continue
;;
esac
echo "===> beanstalkd profile: ${profile}"
if /usr/local/etc/rc.d/beanstalkd $1 ${profile} ; then
success="${profile} ${success:-}"
else
failed="${profile} (${retcode}) ${failed:-}"
fi
done
exit 0
fi
fi
beanstalkd_poststop()
{
if [ -n "${profile}" ]; then
[ -e "$pidfile" ] && unlink $pidfile
else
local file
for file in ${_piddir}/* ; do
case "$file" in
*\*)
continue ;;
esac
unlink $file
done
fi
}
beanstalkd_prestart()
{
install -d -o $beanstalkd_user -g $beanstalkd_user -m 755 $_piddir
}
: ${beanstalkd_enable="NO"}
: ${beanstalkd_user="nobody"}
procname=/usr/local/bin/beanstalkd
command="/usr/sbin/daemon"
command_args="-p ${pidfile} ${procname} ${beanstalkd_flags}"
unset beanstalkd_flags
start_precmd="${name}_prestart"
stop_postcmd="${name}_poststop"
run_rc_command "$1"

I will test a few signals to find out which one the script sends to beanstalkd.

Thanks.
Reply all
Reply to author
Forward
0 new messages