|
List Info
Thread: Memory leak
|
|
| Memory leak |
  United States |
2007-07-23 14:33:47 |
|
|
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
|
| Re: Memory leak |
  United States |
2007-07-24 15:30:38 |
|
|
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: 'red5 osflash.org'
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
|
| Re: Memory leak |

|
2007-07-24 15:49:39 |
Hi Adrian,
Roston, Adrian - iFilm schrieb:
> I believe we've found a bug.
[...]
> Which leads to a memory leak. We wrapped this call in
a try/catch and
> the problem has gone away.
thanks for pointing this out. Could you please describe a
bit more where
the NPE is thrown and in which cases?
Anyway, please create a patch about your try/catch change
against the
latest SVN trunk and add a ticket to jira.red5.org so we can
fix this
issue.
Joachim
_______________________________________________
Red5 mailing list
Red5 osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
|
|
| Re: Memory leak |
  United States |
2007-07-24 16:34:45 |
Sure...
Here's the stack trace
java.lang.NullPointerException
at
org.red5.server.CoreHandler.connect(CoreHandler.java:77)
at org.red5.server.Scope.connect(Scope.java:391)
at org.red5.server.Scope.connect(Scope.java:388)
at
org.red5.server.BaseConnection.connect(BaseConnection.java:2
64)
at
org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnecti
on.java:241)
at
org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMina
Connection.j
ava:67)
at
org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.ja
va:266)
at
org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(Bas
eRTMPHandler
.java:143)
at
org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(R
TMPMinaIoHan
dler.java:120)
at
org.apache.mina.common.support.AbstractIoFilterChain$TailFil
ter.messageR
eceived(AbstractIoFilterChain.java:703)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNex
tMessageRece
ived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$
1100(Abstrac
tIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryIm
pl$1.message
Received(AbstractIoFilterChain.java:800)
at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(
ExecutorFilt
er.java:247)
at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEvents
Runnable.run
(ExecutorFilter.java:307)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa
dPoolExecuto
r.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
lExecutor.ja
va:907)
at java.lang.Thread.run(Thread.java:619)
The caveat to the fix we did is, this only prevents the
memory leak, but
does not solve the root of the problem. Perhaps using a
harvesting
thread to do the removals will solve it, rather than using
WeakReferences and counting on the vm to do the cleanup? I
opened the
ticket in JIRA.
--Adrian
-----Original Message-----
From: red5-bounces osflash.org [mailto:red5-bounces osflash.org] On
Behalf Of Joachim Bauch
Sent: Tuesday, July 24, 2007 1:50 PM
To: red5 osflash.org
Subject: Re: [Red5] Memory leak
Hi Adrian,
Roston, Adrian - iFilm schrieb:
> I believe we've found a bug.
[...]
> Which leads to a memory leak. We wrapped this call in
a try/catch and
> the problem has gone away.
thanks for pointing this out. Could you please describe a
bit more where
the NPE is thrown and in which cases?
Anyway, please create a patch about your try/catch change
against the
latest SVN trunk and add a ticket to jira.red5.org so we can
fix this
issue.
Joachim
_______________________________________________
Red5 mailing list
Red5 osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
_______________________________________________
Red5 mailing list
Red5 osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
|
|
[1-4]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|