Problems on FreeBSD

22 views
Skip to first unread message

Drew Taylor

unread,
May 11, 2009, 12:14:47 PM5/11/09
to beanstalk-talk
Hi all,

I'm in need of a job queue, and am evaluating beanstalkd. Problem is,
detach mode simply isn't working on my FreeBSD 6.3 box. It immediately
dies with no messaging whatsoever, and no beanstalkd process. I've
tried the v1.2 port, from 1.3 tarball and from git source. I'm running
the latest libevent 1.4.10 from ports. When compiling from source,
"make check" returns a strange error. I saw a message in the archives
with a similar problem (http://groups.google.com/group/beanstalk-talk/
browse_thread/thread/bdda1e5ebf2b1d7a/cd072a169fb3ba45?
lnk=gst&q=freebsd#cd072a169fb3ba45), but the fix apparently isn't
working for me.

Any ideas?

# uname -a
FreeBSD skidoo-bsd.xxxxx 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan
16 04:18:52 UTC 2008 ro...@dessler.cse.buffalo.edu:/usr/obj/usr/src/
sys/GENERIC i386
root@skidoo-bsd # make
make all-am
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o
beanstalkd.o beanstalkd.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o
binlog.o binlog.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o conn.o
conn.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o job.o
job.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o ms.o
ms.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o net.o
net.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o pq.o
pq.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o
primes.o primes.c
primes.c:41: warning: this decimal constant is unsigned only in ISO
C90
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o prot.o
prot.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o tube.o
tube.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o util.o
util.c
gcc -g -O2 -I/usr/local/include -L/usr/local/lib -R/usr/local/lib -o
beanstalkd beanstalkd.o binlog.o conn.o job.o ms.o net.o pq.o
primes.o prot.o tube.o util.o -levent -levent
root@skidoo-bsd # make check
gcc -g -O2 -I/usr/local/include -L/usr/local/lib -R/usr/local/lib
cutgen.c -o cutgen
mkdir -p tests
./cutgen -o tests/cutcheck.c ./tests/test_job.c ./tests/test_pq.c
- parsing './tests/test_job.c'... done.
- parsing './tests/test_pq.c'... done.
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o tests/
cutcheck.o tests/cutcheck.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o cut.o
cut.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o tests/
test_job.o tests/test_job.c
tests/test_job.c: In function `__CUT__job_test_all_jobs_used':
tests/test_job.c:100: warning: initialization makes pointer from
integer without a cast
gcc -DHAVE_CONFIG_H -I. -g -O2 -I/usr/local/include -c -o tests/
test_pq.o tests/test_pq.c
gcc -g -O2 -I/usr/local/include -L/usr/local/lib -R/usr/local/lib -o
tests/cutcheck -levent -levent
/usr/lib/crt1.o(.text+0x72): In function `_start':
: undefined reference to `main'
*** Error code 1

Stop in /usr/local/src/beanstalkd-1.3.

Thanks,
Drew

Keith Rarick

unread,
May 11, 2009, 5:14:09 PM5/11/09
to beansta...@googlegroups.com
On Mon, May 11, 2009 at 9:14 AM, Drew Taylor <taylor....@gmail.com> wrote:
> I'm in need of a job queue, and am evaluating beanstalkd. Problem is,
> detach mode simply isn't working on my FreeBSD 6.3 box. It immediately
> dies with no messaging whatsoever, and no beanstalkd process.

I don't have ready access to a FreeBSD box, but I'll set up a VM if necessary.

For now, can you try deleting or commenting out most of the daemonize
function in beanstalkd.c? Leave only the last line. It should go from
this:

static void
daemonize()
{
chdir("/");
nullfd(0, O_RDONLY);
nullfd(1, O_WRONLY);
nullfd(2, O_WRONLY);
umask(0);
dfork();
setsid();
dfork();
}

To this:

static void
daemonize()
{
dfork();
}

This change should let you see error messages that happen after the
fork. If you post those messages it'll give me a clue what is going
on.

> When compiling from source,
> "make check" returns a strange error.

That's weird. The command "gcc -g -O2 -I/usr/local/include


-L/usr/local/lib -R/usr/local/lib -o tests/cutcheck -levent

-levent" seems to have no source file in it. Somehow that command was
generated wrong. Unfortunately I'm not so good with the build system.
I'll look at it but I can't predict how long I'll take to fix it.

Antony or other autoconf people, how do we fix this?

kr

Drew Taylor

unread,
May 12, 2009, 7:52:23 AM5/12/09
to beanstalk-talk
On May 11, 10:14 pm, Keith Rarick <k...@xph.us> wrote:
It's a bit more helpful now:

root@skidoo-bsd # /usr/local/bin/beanstalkd -d -u nobody
root@skidoo-bsd # [warn] kevent: Bad file descriptor
/usr/local/bin/beanstalkd: beanstalkd.c:290 in main: got here for some
reason

I'm running libevent 1.4.10 if that helps.

BTW, I have to use the 1.3 release because of the lack of
posix_fallocate on FreeBSD.

Drew

Keith Rarick

unread,
May 12, 2009, 4:42:38 PM5/12/09
to beansta...@googlegroups.com
On Tue, May 12, 2009 at 4:52 AM, Drew Taylor <taylor....@gmail.com> wrote:

> It's a bit more helpful now:
>
> root@skidoo-bsd # /usr/local/bin/beanstalkd -d -u nobody
> root@skidoo-bsd # [warn] kevent: Bad file descriptor
> /usr/local/bin/beanstalkd: beanstalkd.c:290 in main: got here for some
> reason
>
> I'm running libevent 1.4.10 if that helps.
>
> BTW, I have to use the 1.3 release because of the lack of
> posix_fallocate on FreeBSD.

Ah, then I think it's just the same problem we saw on Mac OS. I'll
push a workaround for the posix_fallocate thing today, if possible.
Then I think you can be up and running.

kr

Keith Rarick

unread,
May 13, 2009, 4:49:21 AM5/13/09
to beansta...@googlegroups.com

This message http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2008-11/msg00029.html
makes me suspect that FreeBSD has no efficient equivalent to
posix_fallocate.

I just pushed some dumb but portable code to allocate space. It will
be slow, but it should work. (And I'd be wary of trusting the binlog
code in production right now anyway. I won't release it until I'm
confident that it's reasonably safe.)

If you're not using the binlog at all, then there should be no
performance problem on FreeBSD or other systems that lack
posix_fallocate.

kr

Drew Taylor

unread,
May 13, 2009, 7:37:41 AM5/13/09
to beanstalk-talk
On May 13, 9:49 am, Keith Rarick <k...@xph.us> wrote:
> On Tue, May 12, 2009 at 1:42 PM, Keith Rarick <k...@xph.us> wrote:
> > On Tue, May 12, 2009 at 4:52 AM, Drew Taylor <taylor.andre...@gmail.com> wrote:
> > I'll push a workaround for the posix_fallocate thing today, if
> > possible. Then I think you can be up and running.
>
> This messagehttp://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2008-11/msg00...
> makes me suspect that FreeBSD has no efficient equivalent to
> posix_fallocate.
>
> I just pushed some dumb but portable code to allocate space. It will
> be slow, but it should work. (And I'd be wary of trusting the binlog
> code in production right now anyway. I won't release it until I'm
> confident that it's reasonably safe.)
>
> If you're not using the binlog at all, then there should be no
> performance problem on FreeBSD or other systems that lack
> posix_fallocate.

Assuming the binlog is the persistence feature in development for 1.4,
I'm not using it (or at least I don't know I'm using it :-).

I can also report that "beanstalkd -d" now works on FreeBSD! Thanks
for the quick work. Now to go look at the perl client...

Drew
Reply all
Reply to author
Forward
0 new messages