[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #4825] gnustep_sndd is hanging the debian build daemons
From: |
nobody |
Subject: |
[bug #4825] gnustep_sndd is hanging the debian build daemons |
Date: |
Mon, 18 Aug 2003 11:35:10 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3 StumbleUpon/1.73 |
=================== BUG #4825: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=4825&group_id=99
Changes by: Eric Heintzmann <eh666@free.fr>
Date: Mon 08/18/03 at 17:35 (Europe/Paris)
------------------ Additional Follow-up Comments ----------------------------
The patch again (to be viewed online) :
--- gsnd/gsnd.m~ 2002-07-30 23:19:05.000000000 +0200
+++ gsnd/gsnd.m 2003-08-14 07:36:43.000000000 +0200
@@ -24,6 +24,7 @@
#include "portaudio/pa_common/portaudio.h"
#include <math.h>
#include <unistd.h>
+#include <fcntl.h>
#ifdef __MINGW__
#include "process.h"
@@ -969,6 +970,8 @@
int main(int argc, char** argv, char **env)
{
+ int is_daemon = 1, c;
+
CREATE_AUTORELEASE_POOL(pool);
#ifdef GS_PASS_ARGUMENTS
@@ -1007,6 +1010,42 @@
}
#endif
+ /*
+ * Ensure we don't have any open file descriptors which may refer
+ * to sockets bound to ports we may try to use.
+ *
+ * Use '/dev/null' for stdin and stdout. Assume stderr is ok.
+ */
+ for (c = 0; c < FD_SETSIZE; c++)
+ {
+ if (is_daemon /*|| (c != 2)*/)
+ {
+ (void)close(c);
+ }
+ }
+ if (open("/dev/null", O_RDONLY) != 0)
+ {
+ NSLog(@"gsnd - failed to open stdin from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (open("/dev/null", O_WRONLY) != 1)
+ {
+ NSLog(@"gsnd - failed to open stdout from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (is_daemon && open("/dev/null", O_WRONLY) != 2)
+ {
+ NSLog(@"gsnd - failed to open stderr from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (0)
+ {
+ NSLog(@"gsnd - Closed descriptors");
+ }
+
gsnd = [[SoundServer alloc] init];
if (gsnd == nil) {
@@ -1262,4 +1301,3 @@
NSLog([NSString stringWithCString: s]);
return -1;
}
-
=================== BUG #4825: FULL BUG SNAPSHOT ===================
Submitted by: ehz Project: GNUstep
Submitted on: Mon 08/18/03 at 17:09
Category: Gui/AppKit Severity: 5 - Major
Bug Group: Bug Resolution: None
Assigned to: None Status: Open
Summary: gnustep_sndd is hanging the debian build daemons
Original Submission: When trying to autobuild packages wich depend on
gnustep-gui0_0.8.8 for debian, gnustep_sndd hangs the debian build daemons.
Report from Ryan Murray :
>gnustep-gui0's sound server is hanging the build daemons
>again, however :(
>
> When building gnustep-gui package or when building
>packages wich depend on gnustep-gui0 ?
>
> Which depend on gnustep-gui0. This can be caused by the
> sound daemon not
> properly backgrounding itself...
>
> What's the status on this? Recent gnustep needing uploads
> hung the buildds again. I'll be excluding these packages
> from the buildds if it isn't fixed the next time it
> happens...
Report from James Troup :
> gnustep_sndd doesn't properly daemonize (fails to close
> fds, I guess?)... Someone should beat "how to program a
> daemon" into gnustep upstream; this isn't the first (or
> second, or third :p) time we've had this problem with
> gnustep daemons.
>
> --
> James
Mattias Klose has written a patch wich fix the problem.
See the attached file.
Follow-up Comments
*******************
-------------------------------------------------------
Date: Mon 08/18/03 at 17:35 By: ehz
The patch again (to be viewed online) :
--- gsnd/gsnd.m~ 2002-07-30 23:19:05.000000000 +0200
+++ gsnd/gsnd.m 2003-08-14 07:36:43.000000000 +0200
@@ -24,6 +24,7 @@
#include "portaudio/pa_common/portaudio.h"
#include <math.h>
#include <unistd.h>
+#include <fcntl.h>
#ifdef __MINGW__
#include "process.h"
@@ -969,6 +970,8 @@
int main(int argc, char** argv, char **env)
{
+ int is_daemon = 1, c;
+
CREATE_AUTORELEASE_POOL(pool);
#ifdef GS_PASS_ARGUMENTS
@@ -1007,6 +1010,42 @@
}
#endif
+ /*
+ * Ensure we don't have any open file descriptors which may refer
+ * to sockets bound to ports we may try to use.
+ *
+ * Use '/dev/null' for stdin and stdout. Assume stderr is ok.
+ */
+ for (c = 0; c < FD_SETSIZE; c++)
+ {
+ if (is_daemon /*|| (c != 2)*/)
+ {
+ (void)close(c);
+ }
+ }
+ if (open("/dev/null", O_RDONLY) != 0)
+ {
+ NSLog(@"gsnd - failed to open stdin from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (open("/dev/null", O_WRONLY) != 1)
+ {
+ NSLog(@"gsnd - failed to open stdout from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (is_daemon && open("/dev/null", O_WRONLY) != 2)
+ {
+ NSLog(@"gsnd - failed to open stderr from /dev/null (%s)",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (0)
+ {
+ NSLog(@"gsnd - Closed descriptors");
+ }
+
gsnd = [[SoundServer alloc] init];
if (gsnd == nil) {
@@ -1262,4 +1301,3 @@
NSLog([NSString stringWithCString: s]);
return -1;
}
-
CC list is empty
File Attachments
****************
-------------------------------------------------------
Date: Mon 08/18/03 at 17:09 Name: patch Size: 1KB By: ehz
patch
http://savannah.gnu.org/bugs/download.php?group_id=99&bug_id=4825&bug_file_id=606
For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=4825&group_id=99
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/