Bug 171691 - sysutils/p5-MogileFS-Server: issues with daemons startup
Summary: sysutils/p5-MogileFS-Server: issues with daemons startup
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-perl (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-16 21:10 UTC by Mikolaj Golub
Modified: 2013-01-16 15:10 UTC (History)
0 users

See Also:


Attachments
file.diff (2.16 KB, patch)
2012-09-16 21:10 UTC, Mikolaj Golub
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Golub freebsd_committer freebsd_triage 2012-09-16 21:10:09 UTC
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

Fix: See the attached patch, which adds missed "command" variable to rc scripts and adds patch for mogstored.

Patch attached with submission follows:
How-To-Repeat: /usr/local/etc/rc.d/mogilefsd onestart
/usr/local/etc/rc.d/mogstored onestart
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-09-16 21:10:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->perl

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Anton Berezin freebsd_committer freebsd_triage 2013-01-14 11:51:25 UTC
State Changed
From-To: open->feedback

Does version 2.66 (currently in ports) fix issue (2)?
Comment 3 Mikolaj Golub freebsd_committer freebsd_triage 2013-01-14 12:59:14 UTC
State Changed
From-To: feedback->open

The version 2.66 does not fix the issue. It has not been fixed upstream yet. 

There is a discussion about the issue on mogilefs list: 

https://groups.google.com/forum/#!msg/mogile/R08CdfZm7YM/54YRfCvK_RkJ 

According to the developers a proper solution is to fix 
Danga::Socket, where the real bug is, not to workaround it in 
mogstored.
Comment 4 Anton Berezin freebsd_committer freebsd_triage 2013-01-14 14:53:41 UTC
State Changed
From-To: open->feedback

Thanks.  In this case, what would your suggestion be? 

If it is not the right thing to work around the bug 
in MogileFS-Server, then I guess we should not be working around  
it in the FreeBSD port of it?
Comment 5 Mikolaj Golub freebsd_committer freebsd_triage 2013-01-14 16:29:27 UTC
State Changed
From-To: feedback->open

Although the patch is just a workaround and does not fixes the 
real problem, it makes mogstored work and does not look like 
introduce any other bug or side effect. 

IMHO it is not the right thing to work around the bug in upstream 
but it is legal to do in the port. I think this is exactly what 
port pathes are for -- to workaround the problem until it is not 
fixed upstream. 

Taking into consideration that there is no any solution for 
Danga::Socket provided so far (even as a patch) and there is an 
issue with the repository, it may take some time while the 
problem is fixed upstream and it would be very good to workaround 
it in our port meantime. 

If you don't like very much the idea to patch p5-MogileFS-Server 
we can use another workaround, mentioned in the initial message: 
modify mogstored rc.d script to start mogstored in foreground and 
use daemon(8) to daemonize it. If you like this solution more I 
can provide a patch.
Comment 6 Anton Berezin freebsd_committer freebsd_triage 2013-01-15 11:39:17 UTC
State Changed
From-To: open->feedback

> If you don't like very much the idea to patch p5-MogileFS-Server 
> we can use another workaround, mentioned in the initial message 

No, not at all.  I was simply trying to get more understanding 
of the problem and possible solutions. 

I agree with patching MogileFS-Server and I think that you should just 
go ahead and commit the patch.  Moreover, I think it would be for the best if 
you take over as a maintainer of the module, since you obviously 
know it well, you are actually using it, you are a committer, 
and you already maintain "adjacent" modules such as 
sysutils/p5-MogileFS-Network. 

Anton.
Comment 7 Mikolaj Golub freebsd_committer freebsd_triage 2013-01-15 15:34:17 UTC
State Changed
From-To: feedback->open

I am not a port committer so I can't commit the patch. 

But I don't object to taking over as a maintainer of 
p5-MogileFS-Server (and the related modules, p5-MogileFS-Client 
and p5-MogileFS-Utils). Please set trociny@FreeBSD.org as a 
MAINTAINER for these ports if you agree.
Comment 8 dfilter service freebsd_committer freebsd_triage 2013-01-16 15:08:13 UTC
Author: tobez
Date: Wed Jan 16 15:07:59 2013
New Revision: 310494
URL: http://svnweb.freebsd.org/changeset/ports/310494

Log:
  sysutils/p5-MogileFS-Server: fix issues with with daemon startup.
  
  Assign maintainership of this and related ports to the submitter -
  he can take better care of these ports than perl@.
  
  PR:		171691
  Submitted by:	trociny

Added:
  head/sysutils/p5-MogileFS-Server/files/patch-mogstored   (contents, props changed)
Modified:
  head/sysutils/p5-MogileFS-Client/Makefile
  head/sysutils/p5-MogileFS-Server/Makefile
  head/sysutils/p5-MogileFS-Server/files/mogilefsd.in
  head/sysutils/p5-MogileFS-Server/files/mogstored.in
  head/sysutils/p5-MogileFS-Utils/Makefile

Modified: head/sysutils/p5-MogileFS-Client/Makefile
==============================================================================
--- head/sysutils/p5-MogileFS-Client/Makefile	Wed Jan 16 14:43:37 2013	(r310493)
+++ head/sysutils/p5-MogileFS-Client/Makefile	Wed Jan 16 15:07:59 2013	(r310494)
@@ -1,9 +1,5 @@
-# New ports collection makefile for:	p5-MogileFS-Client
-# Date created:		2007-04-22
-# Whom:			Gea-Suan Lin <gslin@gslin.org>
-#
+# Created by: Gea-Suan Lin <gslin@gslin.org>
 # $FreeBSD$
-#
 
 PORTNAME=	MogileFS-Client
 PORTVERSION=	1.16
@@ -12,7 +8,7 @@ MASTER_SITES=	CPAN
 MASTER_SITE_SUBDIR=	CPAN:DORMANDO
 PKGNAMEPREFIX=	p5-
 
-MAINTAINER=	perl@FreeBSD.org
+MAINTAINER=	trociny@FreeBSD.org
 COMMENT=	Client library for the MogileFS distributed file system
 
 BUILD_DEPENDS=	p5-IO-stringy>=2.102:${PORTSDIR}/devel/p5-IO-stringy \

Modified: head/sysutils/p5-MogileFS-Server/Makefile
==============================================================================
--- head/sysutils/p5-MogileFS-Server/Makefile	Wed Jan 16 14:43:37 2013	(r310493)
+++ head/sysutils/p5-MogileFS-Server/Makefile	Wed Jan 16 15:07:59 2013	(r310494)
@@ -3,12 +3,13 @@
 
 PORTNAME=	MogileFS-Server
 PORTVERSION=	2.66
+PORTREVISION=	1
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	CPAN
 MASTER_SITE_SUBDIR=	CPAN:DORMANDO
 PKGNAMEPREFIX=	p5-
 
-MAINTAINER=	perl@FreeBSD.org
+MAINTAINER=	trociny@FreeBSD.org
 COMMENT=	MogileFS (distributed filesystem) server
 
 BUILD_DEPENDS=	p5-Danga-Socket>=1.56:${PORTSDIR}/devel/p5-Danga-Socket \

Modified: head/sysutils/p5-MogileFS-Server/files/mogilefsd.in
==============================================================================
--- head/sysutils/p5-MogileFS-Server/files/mogilefsd.in	Wed Jan 16 14:43:37 2013	(r310493)
+++ head/sysutils/p5-MogileFS-Server/files/mogilefsd.in	Wed Jan 16 15:07:59 2013	(r310494)
@@ -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"

Modified: head/sysutils/p5-MogileFS-Server/files/mogstored.in
==============================================================================
--- head/sysutils/p5-MogileFS-Server/files/mogstored.in	Wed Jan 16 14:43:37 2013	(r310493)
+++ head/sysutils/p5-MogileFS-Server/files/mogstored.in	Wed Jan 16 15:07:59 2013	(r310494)
@@ -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"

Added: head/sysutils/p5-MogileFS-Server/files/patch-mogstored
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/p5-MogileFS-Server/files/patch-mogstored	Wed Jan 16 15:07:59 2013	(r310494)
@@ -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:

Modified: head/sysutils/p5-MogileFS-Utils/Makefile
==============================================================================
--- head/sysutils/p5-MogileFS-Utils/Makefile	Wed Jan 16 14:43:37 2013	(r310493)
+++ head/sysutils/p5-MogileFS-Utils/Makefile	Wed Jan 16 15:07:59 2013	(r310494)
@@ -8,7 +8,7 @@ MASTER_SITES=	CPAN
 MASTER_SITE_SUBDIR=	CPAN:DORMANDO
 PKGNAMEPREFIX=	p5-
 
-MAINTAINER=	perl@FreeBSD.org
+MAINTAINER=	trociny@FreeBSD.org
 COMMENT=	MogileFS tools
 
 BUILD_DEPENDS=	p5-MogileFS-Client>=1.16:${PORTSDIR}/sysutils/p5-MogileFS-Client \
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 9 Anton Berezin freebsd_committer freebsd_triage 2013-01-16 15:08:23 UTC
State Changed
From-To: open->closed

The fix has been committed. Thank you for your submission.