RE: Problems with URLAudio and leaking filedescriptors on record

"stephen" <[email protected]> Wed, 31 May 2006 17:08:59 -0500
Newsgroups gmane.comp.gnu.bayonne.devel
Message-ID <[email protected]>
Anthony,

After over 3,500 messages recorded and over 50K 
playbacks today(people record then broadcast to lists)
I have Zero (0) open file descriptors hung on my 
Bayonne instance.. Applying patch to all my production
systems.  
  
Thanks for the Patch. 

Stephen Barclay
Sr Engineer / Applications Developer


Stephen Barclay
Sr Engineer / Applications Developer
------------------------------------
ph:    972-841-1313
MSN:   [email protected]
AIM:   sbarclay8308
Yahoo: sbarclay8308
 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Anthony DeRobertis
Sent: Friday, May 26, 2006 11:09 AM
Cc: [email protected]
Subject: Re: [Bayonne-devel] Problems with URLAudio and leaking
filedescriptors on record

Did anyone take a look at this patch? Here, at least, it seems to have 
been running in production for over a week...


_______________________________________________
Bayonne-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bayonne-devel


Every time we record an audio file with 1.2.14pl2, Bayonne is leaking 
the file descriptor (=leaving the file open). This appears to be because 
afSeek is failing, because URLAudio is not seeing the recorded files as 
Socket::STREAM.

I think this is because they are being opened by afCreate in ccAudio --- 
which of course has no knowledge of URLAudio.

The following patch adds in a URLAudio::afCreate which seems to fix the 
problem. Is there a better approach?

diff -rdbU3 bayonne-1.2.14pl2/server/audio.cpp
bayonne-1.2.14pl2.new/server/audio.cpp
--- bayonne-1.2.14pl2/server/audio.cpp	2006-05-16 14:21:37.000000000 -0400
+++ bayonne-1.2.14pl2.new/server/audio.cpp	2006-05-16
16:53:30.000000000 -0400
@@ -53,6 +53,26 @@
 	return false;
 }
 
+
+bool URLAudio::afCreate(const char *path)
+{
+	offset = 0;
+
+	setProxy(NULL, 0);
+
+	/* this is an evil hack */
+	::close(::open(path, O_CREAT | O_TRUNC | O_RDWR, 0660));
+	
+	if(URLStream::errSuccess == get(path, 0))
+	{
+		file.fd = so;
+		return true;
+	}
+	file.fd = -1;
+	return false;
+}
+
+
 bool URLAudio::isOpen(void)
 {
 	if(so > -1)
diff -rdbU3 bayonne-1.2.14pl2/server/server.h
bayonne-1.2.14pl2.new/server/server.h
--- bayonne-1.2.14pl2/server/server.h	2003-04-23 11:42:00.000000000 -0400
+++ bayonne-1.2.14pl2.new/server/server.h	2006-05-16
16:21:41.000000000 -0400
@@ -120,6 +120,7 @@
 private:
 	unsigned long offset;
 	bool afOpen(const char *path);
+	bool afCreate(const char *path);
 	bool afPeek(unsigned char *data, unsigned size);
 	bool afSeek(unsigned long pos);
 	void afClose(void);




_______________________________________________
Bayonne-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bayonne-devel