Ticket #891 (closed Bug: Fixed)

Opened 18 months ago

Last modified 17 months ago

Memory leak in RTMPProtocolDecoder SVN trunk rev 4131

Reported by: martinschipper Owned by: mondain
Priority: Major Component: App Server
Version: Keywords:
Cc:

Description

There is a memoryleak in RTMPProtocolDecoder while recording a live broadcastStream. It still exists in trunk 4131.
It comes with a lot of logmessages:

[ERROR] [NioProcessor-2] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Last header null not new, headerSize: 1, channelId 32

Google helped me to the solution :)

 http://old.nabble.com/Recording-high-quality-video-using-a-local-buffer--td28902800.html
 http://osflash.org/pipermail/red5_osflash.org/2009-October/037889.html

Object "lastHeader" is referenced somewhere else so it should remain "null" or it will consume (a lot of) memory.
I didn't replicate the bug in my development installation so I don't know the exact cause (I suspect a fauly clientconnection(object)).

The following patch fixes it;

--- src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java	(revision 4131)
+++ src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java	(working copy)
@@ -464,9 +464,13 @@
 		header.setIsGarbage(false);
 
 		if (headerSize != HEADER_NEW && lastHeader == null) {
-			log.error("Last header null not new, headerSize: {}, channelId {}", headerSize, channelId);
-			lastHeader = new Header();
-			lastHeader.setChannelId(channelId);
+			log.error("DBCORP PATCH Last header null not new, headerSize: {}, channelId {}", headerSize, channelId);
+			// YYY: DBCORP PATCH! see: http://old.nabble.com/Recording-high-quality-video-using-a-local-buffer--td28902800.html
+			// or http://osflash.org/pipermail/red5_osflash.org/2009-October/037889.html
+			header = null;
+			return null;
+			//lastHeader = new Header();
+			//lastHeader.setChannelId(channelId);
 		}
 
 		int timeValue;

Change History

Changed 17 months ago by mondain

  • status changed from new to closed
  • resolution set to Fixed

Addressed at revision 4136

Note: See TracTickets for help on using tickets.