Hi,

I believe we've found a bug.  

In the Red5 class(line 51):

private static ThreadLocal<WeakReference<IConnection>> connThreadLocal =
new ThreadLocal<WeakReference<IConnection>>();

The theory is, under load, the threads get waited and occasionally this
Iconnection gets garbage collected out from underneath due to the
WeakReference.
When this object is null,  a NPE exception is thrown and the connection
is never removed from this Map in Scope.java(line 250)

private volatile Map<IClient, Set<IConnection>> clients = new
ConcurrentHashMap<IClient, Set<IConnection>>();


Which leads to a memory leak.  We wrapped this call in a try/catch and
the problem has gone away.

Best,

Adrian



> _____________________________________________ 
> From:         Roston, Adrian - iFilm  
> Sent: Monday, July 23, 2007 12:34 PM
> To:   '[email protected]'
> Subject:      Memory leak
> 
> Hello,
> 
> We are using the latest jar for red5, and we are experiencing out of
> memory errors after about 4 hours of heavy use (with 2 gig heap).  We
> did a quick profile with jmap and saw large ConcurrentHashmaps, has
> anyone else seen this behavior?
> 
> Thanks,
> 
> Adrian
> 
> 
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to