Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2012 20:08:59 GMT
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/171691: sysutils/p5-MogileFS-Server: issues with daemons startup
Message-ID:  <201209162008.q8GK8x5g055196@red.freebsd.org>
Resent-Message-ID: <201209162010.q8GKAABp060253@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171691
>Category:       ports
>Synopsis:       sysutils/p5-MogileFS-Server: issues with daemons startup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 16 20:10:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Mikolaj Golub
>Release:        
>Organization:
>Environment:
>Description:
Two issues are observed when trying to start mogilefs daemons:

1) When running mogstored or mogilefsd rc.d script the error like below is observed:

Starting mogstored.
--config=/usr/local/etc/mogstored.conf: not found
./mogstored: WARNING: failed to start mogstored

It looks like "command" variable is missed in the scripts.

2) While mogstored runs OK in the foreground mode, it fails to start when daemonize option is specified.

The issue is that Danga::Socket (and its kqueue(2)) is initialized in $httpsrv->start, before daemonize. After daemonize the mogstored tries to (re)use the kqueue descriptor but kevent(2) fails with "bad file descriptor", because kernel event queue is not inherited after fork(2) (see kqueue(2)).

A possible workaround is to run mogstored without '-d' option, using daemon(8).

A possible fix is to deamonize before calling $httpsrv->start. 

I have reported about this issue to mainstream:

http://code.google.com/p/mogilefs/issues/detail?id=72
>How-To-Repeat:
/usr/local/etc/rc.d/mogilefsd onestart
/usr/local/etc/rc.d/mogstored onestart
>Fix:
See the attached patch, which adds missed "command" variable to rc scripts and adds patch for mogstored.

Patch attached with submission follows:

Index: sysutils/p5-MogileFS-Server/files/patch-mogstored
===================================================================
--- sysutils/p5-MogileFS-Server/files/patch-mogstored	(revision 0)
+++ sysutils/p5-MogileFS-Server/files/patch-mogstored	(working copy)
@@ -0,0 +1,20 @@
+--- mogstored.ORIG	2012-09-16 12:38:08.000000000 +0300
++++ mogstored	2012-09-16 18:48:02.000000000 +0300
+@@ -99,8 +99,6 @@ my $httpsrv       = $httpsrv_class->new(
+                                         maxconns => $max_conns,
+                                         bin      => $serverbin,
+                                         );
+-$httpsrv->start;
+-
+ if ($opt_daemonize) {
+     $httpsrv->pre_daemonize;
+     Perlbal::daemonize();
+@@ -108,6 +106,8 @@ if ($opt_daemonize) {
+     print "Running.\n";
+ }
+ 
++$httpsrv->start;
++
+ $httpsrv->post_daemonize;
+ 
+ # kill our children processes on exit:
Index: sysutils/p5-MogileFS-Server/files/mogstored.in
===================================================================
--- sysutils/p5-MogileFS-Server/files/mogstored.in	(revision 303538)
+++ sysutils/p5-MogileFS-Server/files/mogstored.in	(working copy)
@@ -17,6 +17,7 @@ load_rc_config mogstored
 
 required_files=%%PREFIX%%/etc/mogstored.conf
 
+command="%%PREFIX%%/bin/${name}"
 command_args="--config=%%PREFIX%%/etc/mogstored.conf -d"
 
 run_rc_command "$1"
Index: sysutils/p5-MogileFS-Server/files/mogilefsd.in
===================================================================
--- sysutils/p5-MogileFS-Server/files/mogilefsd.in	(revision 303538)
+++ sysutils/p5-MogileFS-Server/files/mogilefsd.in	(working copy)
@@ -17,6 +17,7 @@ load_rc_config mogilefsd
 
 required_files=%%PREFIX%%/etc/mogtracker.conf
 
+command="%%PREFIX%%/bin/${name}"
 command_args="--config=%%PREFIX%%/etc/mogtracker.conf"
 
 run_rc_command "$1"
Index: sysutils/p5-MogileFS-Server/Makefile
===================================================================
--- sysutils/p5-MogileFS-Server/Makefile	(revision 303538)
+++ sysutils/p5-MogileFS-Server/Makefile	(working copy)
@@ -7,6 +7,7 @@
 
 PORTNAME=	MogileFS-Server
 PORTVERSION=	2.65
+PORTREVISION=	1
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	CPAN
 MASTER_SITE_SUBDIR=	CPAN:DORMANDO


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209162008.q8GK8x5g055196>