You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Paul Spencer <pa...@apache.org> on 2014/12/09 18:46:31 UTC
60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump. Why?
I have a test case that connects to a Karaf 3.0.2 server via SSH to reset the environment prior to making WebService calls to the server. After upgrading from Karaf 2.3.4 I started noticing "java.lang.OutOfMemoryError: Java heap space” errors. In looking around I noticed 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump when the Karaf server had only run a few rounds of testing.
1) Although I have searched without finding a definitive answer, Is this a known issue?
2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and some custom bundles. In addition to the attached screen image from the Eclipse Memory Analyzer, what additional information should I provided?
***
* Code to programmatically connect to Karaf via ssh and issue reset commands.
***
String host = “localhost”;
int port = 8101;
String user = "karaf";
String password = "karaf";
SshClient client = null;
String line = null;
try {
client = SshClient.setUpDefaultClient();
client.start();
ConnectFuture future = client.connect(user, host, port);
future.await();
ClientSession session = future.getSession();
session.addPasswordIdentity(password);
session.auth().verify();
ClientChannel channel = session.createExecChannel(command);
InputStream is = new FileInputStream("/dev/null");
PipedInputStream pi = new PipedInputStream();
PipedOutputStream po = new PipedOutputStream(pi);
InputStreamReader isr = new InputStreamReader(pi);
LineNumberReader lr = new LineNumberReader(isr);
channel.setIn(is);
channel.setOut(po);
channel.setErr(System.err);
channel.open();
channel.waitFor(ClientChannel.CLOSED, 0);
line = lr.readLine();
lr.close();
is.close();
} catch (InterruptedException e) {
e.printStackTrace();
throw e;
} catch (IOException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
client.stop();
}
Paul Spencer
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump. Why?
Posted by Paul Spencer <pa...@apache.org>.
JB,
I have added “session.close()” after “channel.waitFor()”, but I still get 32,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump after each testing cycle.
channel.open();
channel.waitFor(ClientChannel.CLOSED, 0);
session.close(false);
line = lr.readLine();
Paul Spencer
On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Can you try to session.close(false) just in case after the waitFor on the channel ?
>
> Regards
> JB
>
> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>> reset the environment prior to making WebService calls to the server.
>> After upgrading from Karaf 2.3.4 I started noticing
>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>> I noticed 60,000+
>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>
>> 1) Although I have searched without finding a definitive answer, Is this
>> a known issue?
>>
>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>> some custom bundles. In addition to the attached screen image from the
>> Eclipse Memory Analyzer, what additional information should I provided?
>>
>> ***
>> * Code to programmatically connect to Karaf via ssh and issue reset
>> commands.
>> ***
>> String host = “localhost”;
>> int port = 8101;
>> String user = "karaf";
>> String password = "karaf";
>>
>> SshClient client = null;
>> String line = null;
>> try {
>> client = SshClient.setUpDefaultClient();
>> client.start();
>> ConnectFuture future = client.connect(user, host, port);
>> future.await();
>> ClientSession session = future.getSession();
>> session.addPasswordIdentity(password);
>> session.auth().verify();
>> ClientChannel channel = session.createExecChannel(command);
>> InputStream is = new FileInputStream("/dev/null");
>> PipedInputStream pi = new PipedInputStream();
>> PipedOutputStream po = new PipedOutputStream(pi);
>> InputStreamReader isr = new InputStreamReader(pi);
>> LineNumberReader lr = new LineNumberReader(isr);
>> channel.setIn(is);
>> channel.setOut(po);
>> channel.setErr(System.err);
>> channel.open();
>> channel.waitFor(ClientChannel.CLOSED, 0);
>> line = lr.readLine();
>>
>> lr.close();
>> is.close();
>> } catch (InterruptedException e) {
>> e.printStackTrace();
>> throw e;
>> } catch (IOException e) {
>> e.printStackTrace();
>> throw e;
>> } catch (Exception e) {
>> e.printStackTrace();
>> throw e;
>> } finally {
>> client.stop();
>> }
>>
>>
>> Paul Spencer
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl
objects in the HeapDump. Why?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Paul,
not yet (I was on something else). I will work on it tonight or tomorrow
morning my time. I keep you posted.
Regards
JB
On 12/11/2014 03:54 PM, Paul Spencer wrote:
> JB,
> Have you been able to reproduce the issue?
>
> Paul Spencer
>
>
> On Dec 9, 2014, at 2:30 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
>> Thanks Paul,
>>
>> I gonna investigate this issue.
>>
>> Regards
>> JB
>>
>> On 12/09/2014 08:23 PM, Paul Spencer wrote:
>>> JB,
>>> One way to reproduce this issue:
>>> - Start Karaf with bin/karaf
>>> - Dump the Heap Memory with a tool like jmap
>>> - Open a second command shell and execute the following command several times:
>>> $KARAF_HOME/bin/client -u karat instance:list
>>> - Dump the Heap Memory with a tool like jmap into a second output file
>>> - Compare the two files with the Eclipse Memory Analyzer
>>>
>>> Paul Spencer
>>>
>>>
>>> On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>>
>>>> Can you try to session.close(false) just in case after the waitFor on the channel ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>>>>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>>>>> reset the environment prior to making WebService calls to the server.
>>>>> After upgrading from Karaf 2.3.4 I started noticing
>>>>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>>>>> I noticed 60,000+
>>>>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>>>>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>>>>
>>>>> 1) Although I have searched without finding a definitive answer, Is this
>>>>> a known issue?
>>>>>
>>>>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>>>>> some custom bundles. In addition to the attached screen image from the
>>>>> Eclipse Memory Analyzer, what additional information should I provided?
>>>>>
>>>>> ***
>>>>> * Code to programmatically connect to Karaf via ssh and issue reset
>>>>> commands.
>>>>> ***
>>>>> String host = “localhost”;
>>>>> int port = 8101;
>>>>> String user = "karaf";
>>>>> String password = "karaf";
>>>>>
>>>>> SshClient client = null;
>>>>> String line = null;
>>>>> try {
>>>>> client = SshClient.setUpDefaultClient();
>>>>> client.start();
>>>>> ConnectFuture future = client.connect(user, host, port);
>>>>> future.await();
>>>>> ClientSession session = future.getSession();
>>>>> session.addPasswordIdentity(password);
>>>>> session.auth().verify();
>>>>> ClientChannel channel = session.createExecChannel(command);
>>>>> InputStream is = new FileInputStream("/dev/null");
>>>>> PipedInputStream pi = new PipedInputStream();
>>>>> PipedOutputStream po = new PipedOutputStream(pi);
>>>>> InputStreamReader isr = new InputStreamReader(pi);
>>>>> LineNumberReader lr = new LineNumberReader(isr);
>>>>> channel.setIn(is);
>>>>> channel.setOut(po);
>>>>> channel.setErr(System.err);
>>>>> channel.open();
>>>>> channel.waitFor(ClientChannel.CLOSED, 0);
>>>>> line = lr.readLine();
>>>>>
>>>>> lr.close();
>>>>> is.close();
>>>>> } catch (InterruptedException e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } catch (IOException e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } catch (Exception e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } finally {
>>>>> client.stop();
>>>>> }
>>>>>
>>>>>
>>>>> Paul Spencer
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump. Why?
Posted by Freeman Fang <fr...@gmail.com>.
FYI, I can reproduce it and create KARAF-3415[1] to track it, and I'm on it
[1]https://issues.apache.org/jira/browse/KARAF-3415
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
On 2014-12-11, at 下午10:54, Paul Spencer wrote:
> JB,
> Have you been able to reproduce the issue?
>
> Paul Spencer
>
>
> On Dec 9, 2014, at 2:30 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
>> Thanks Paul,
>>
>> I gonna investigate this issue.
>>
>> Regards
>> JB
>>
>> On 12/09/2014 08:23 PM, Paul Spencer wrote:
>>> JB,
>>> One way to reproduce this issue:
>>> - Start Karaf with bin/karaf
>>> - Dump the Heap Memory with a tool like jmap
>>> - Open a second command shell and execute the following command several times:
>>> $KARAF_HOME/bin/client -u karat instance:list
>>> - Dump the Heap Memory with a tool like jmap into a second output file
>>> - Compare the two files with the Eclipse Memory Analyzer
>>>
>>> Paul Spencer
>>>
>>>
>>> On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>>
>>>> Can you try to session.close(false) just in case after the waitFor on the channel ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>>>>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>>>>> reset the environment prior to making WebService calls to the server.
>>>>> After upgrading from Karaf 2.3.4 I started noticing
>>>>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>>>>> I noticed 60,000+
>>>>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>>>>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>>>>
>>>>> 1) Although I have searched without finding a definitive answer, Is this
>>>>> a known issue?
>>>>>
>>>>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>>>>> some custom bundles. In addition to the attached screen image from the
>>>>> Eclipse Memory Analyzer, what additional information should I provided?
>>>>>
>>>>> ***
>>>>> * Code to programmatically connect to Karaf via ssh and issue reset
>>>>> commands.
>>>>> ***
>>>>> String host = “localhost”;
>>>>> int port = 8101;
>>>>> String user = "karaf";
>>>>> String password = "karaf";
>>>>>
>>>>> SshClient client = null;
>>>>> String line = null;
>>>>> try {
>>>>> client = SshClient.setUpDefaultClient();
>>>>> client.start();
>>>>> ConnectFuture future = client.connect(user, host, port);
>>>>> future.await();
>>>>> ClientSession session = future.getSession();
>>>>> session.addPasswordIdentity(password);
>>>>> session.auth().verify();
>>>>> ClientChannel channel = session.createExecChannel(command);
>>>>> InputStream is = new FileInputStream("/dev/null");
>>>>> PipedInputStream pi = new PipedInputStream();
>>>>> PipedOutputStream po = new PipedOutputStream(pi);
>>>>> InputStreamReader isr = new InputStreamReader(pi);
>>>>> LineNumberReader lr = new LineNumberReader(isr);
>>>>> channel.setIn(is);
>>>>> channel.setOut(po);
>>>>> channel.setErr(System.err);
>>>>> channel.open();
>>>>> channel.waitFor(ClientChannel.CLOSED, 0);
>>>>> line = lr.readLine();
>>>>>
>>>>> lr.close();
>>>>> is.close();
>>>>> } catch (InterruptedException e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } catch (IOException e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } catch (Exception e) {
>>>>> e.printStackTrace();
>>>>> throw e;
>>>>> } finally {
>>>>> client.stop();
>>>>> }
>>>>>
>>>>>
>>>>> Paul Spencer
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump. Why?
Posted by Paul Spencer <pa...@apache.org>.
JB,
Have you been able to reproduce the issue?
Paul Spencer
On Dec 9, 2014, at 2:30 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Thanks Paul,
>
> I gonna investigate this issue.
>
> Regards
> JB
>
> On 12/09/2014 08:23 PM, Paul Spencer wrote:
>> JB,
>> One way to reproduce this issue:
>> - Start Karaf with bin/karaf
>> - Dump the Heap Memory with a tool like jmap
>> - Open a second command shell and execute the following command several times:
>> $KARAF_HOME/bin/client -u karat instance:list
>> - Dump the Heap Memory with a tool like jmap into a second output file
>> - Compare the two files with the Eclipse Memory Analyzer
>>
>> Paul Spencer
>>
>>
>> On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>
>>> Can you try to session.close(false) just in case after the waitFor on the channel ?
>>>
>>> Regards
>>> JB
>>>
>>> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>>>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>>>> reset the environment prior to making WebService calls to the server.
>>>> After upgrading from Karaf 2.3.4 I started noticing
>>>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>>>> I noticed 60,000+
>>>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>>>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>>>
>>>> 1) Although I have searched without finding a definitive answer, Is this
>>>> a known issue?
>>>>
>>>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>>>> some custom bundles. In addition to the attached screen image from the
>>>> Eclipse Memory Analyzer, what additional information should I provided?
>>>>
>>>> ***
>>>> * Code to programmatically connect to Karaf via ssh and issue reset
>>>> commands.
>>>> ***
>>>> String host = “localhost”;
>>>> int port = 8101;
>>>> String user = "karaf";
>>>> String password = "karaf";
>>>>
>>>> SshClient client = null;
>>>> String line = null;
>>>> try {
>>>> client = SshClient.setUpDefaultClient();
>>>> client.start();
>>>> ConnectFuture future = client.connect(user, host, port);
>>>> future.await();
>>>> ClientSession session = future.getSession();
>>>> session.addPasswordIdentity(password);
>>>> session.auth().verify();
>>>> ClientChannel channel = session.createExecChannel(command);
>>>> InputStream is = new FileInputStream("/dev/null");
>>>> PipedInputStream pi = new PipedInputStream();
>>>> PipedOutputStream po = new PipedOutputStream(pi);
>>>> InputStreamReader isr = new InputStreamReader(pi);
>>>> LineNumberReader lr = new LineNumberReader(isr);
>>>> channel.setIn(is);
>>>> channel.setOut(po);
>>>> channel.setErr(System.err);
>>>> channel.open();
>>>> channel.waitFor(ClientChannel.CLOSED, 0);
>>>> line = lr.readLine();
>>>>
>>>> lr.close();
>>>> is.close();
>>>> } catch (InterruptedException e) {
>>>> e.printStackTrace();
>>>> throw e;
>>>> } catch (IOException e) {
>>>> e.printStackTrace();
>>>> throw e;
>>>> } catch (Exception e) {
>>>> e.printStackTrace();
>>>> throw e;
>>>> } finally {
>>>> client.stop();
>>>> }
>>>>
>>>>
>>>> Paul Spencer
>>>>
>>>
>>> --
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl
objects in the HeapDump. Why?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Paul,
I gonna investigate this issue.
Regards
JB
On 12/09/2014 08:23 PM, Paul Spencer wrote:
> JB,
> One way to reproduce this issue:
> - Start Karaf with bin/karaf
> - Dump the Heap Memory with a tool like jmap
> - Open a second command shell and execute the following command several times:
> $KARAF_HOME/bin/client -u karat instance:list
> - Dump the Heap Memory with a tool like jmap into a second output file
> - Compare the two files with the Eclipse Memory Analyzer
>
> Paul Spencer
>
>
> On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
>> Can you try to session.close(false) just in case after the waitFor on the channel ?
>>
>> Regards
>> JB
>>
>> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>>> reset the environment prior to making WebService calls to the server.
>>> After upgrading from Karaf 2.3.4 I started noticing
>>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>>> I noticed 60,000+
>>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>>
>>> 1) Although I have searched without finding a definitive answer, Is this
>>> a known issue?
>>>
>>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>>> some custom bundles. In addition to the attached screen image from the
>>> Eclipse Memory Analyzer, what additional information should I provided?
>>>
>>> ***
>>> * Code to programmatically connect to Karaf via ssh and issue reset
>>> commands.
>>> ***
>>> String host = “localhost”;
>>> int port = 8101;
>>> String user = "karaf";
>>> String password = "karaf";
>>>
>>> SshClient client = null;
>>> String line = null;
>>> try {
>>> client = SshClient.setUpDefaultClient();
>>> client.start();
>>> ConnectFuture future = client.connect(user, host, port);
>>> future.await();
>>> ClientSession session = future.getSession();
>>> session.addPasswordIdentity(password);
>>> session.auth().verify();
>>> ClientChannel channel = session.createExecChannel(command);
>>> InputStream is = new FileInputStream("/dev/null");
>>> PipedInputStream pi = new PipedInputStream();
>>> PipedOutputStream po = new PipedOutputStream(pi);
>>> InputStreamReader isr = new InputStreamReader(pi);
>>> LineNumberReader lr = new LineNumberReader(isr);
>>> channel.setIn(is);
>>> channel.setOut(po);
>>> channel.setErr(System.err);
>>> channel.open();
>>> channel.waitFor(ClientChannel.CLOSED, 0);
>>> line = lr.readLine();
>>>
>>> lr.close();
>>> is.close();
>>> } catch (InterruptedException e) {
>>> e.printStackTrace();
>>> throw e;
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> throw e;
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> throw e;
>>> } finally {
>>> client.stop();
>>> }
>>>
>>>
>>> Paul Spencer
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects in the HeapDump. Why?
Posted by Paul Spencer <pa...@apache.org>.
JB,
One way to reproduce this issue:
- Start Karaf with bin/karaf
- Dump the Heap Memory with a tool like jmap
- Open a second command shell and execute the following command several times:
$KARAF_HOME/bin/client -u karat instance:list
- Dump the Heap Memory with a tool like jmap into a second output file
- Compare the two files with the Eclipse Memory Analyzer
Paul Spencer
On Dec 9, 2014, at 12:52 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> Can you try to session.close(false) just in case after the waitFor on the channel ?
>
> Regards
> JB
>
> On 12/09/2014 06:46 PM, Paul Spencer wrote:
>> I have a test case that connects to a Karaf 3.0.2 server via SSH to
>> reset the environment prior to making WebService calls to the server.
>> After upgrading from Karaf 2.3.4 I started noticing
>> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
>> I noticed 60,000+
>> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
>> in the HeapDump when the Karaf server had only run a few rounds of testing.
>>
>> 1) Although I have searched without finding a definitive answer, Is this
>> a known issue?
>>
>> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
>> some custom bundles. In addition to the attached screen image from the
>> Eclipse Memory Analyzer, what additional information should I provided?
>>
>> ***
>> * Code to programmatically connect to Karaf via ssh and issue reset
>> commands.
>> ***
>> String host = “localhost”;
>> int port = 8101;
>> String user = "karaf";
>> String password = "karaf";
>>
>> SshClient client = null;
>> String line = null;
>> try {
>> client = SshClient.setUpDefaultClient();
>> client.start();
>> ConnectFuture future = client.connect(user, host, port);
>> future.await();
>> ClientSession session = future.getSession();
>> session.addPasswordIdentity(password);
>> session.auth().verify();
>> ClientChannel channel = session.createExecChannel(command);
>> InputStream is = new FileInputStream("/dev/null");
>> PipedInputStream pi = new PipedInputStream();
>> PipedOutputStream po = new PipedOutputStream(pi);
>> InputStreamReader isr = new InputStreamReader(pi);
>> LineNumberReader lr = new LineNumberReader(isr);
>> channel.setIn(is);
>> channel.setOut(po);
>> channel.setErr(System.err);
>> channel.open();
>> channel.waitFor(ClientChannel.CLOSED, 0);
>> line = lr.readLine();
>>
>> lr.close();
>> is.close();
>> } catch (InterruptedException e) {
>> e.printStackTrace();
>> throw e;
>> } catch (IOException e) {
>> e.printStackTrace();
>> throw e;
>> } catch (Exception e) {
>> e.printStackTrace();
>> throw e;
>> } finally {
>> client.stop();
>> }
>>
>>
>> Paul Spencer
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
Re: 60,000+ org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl
objects in the HeapDump. Why?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Can you try to session.close(false) just in case after the waitFor on
the channel ?
Regards
JB
On 12/09/2014 06:46 PM, Paul Spencer wrote:
> I have a test case that connects to a Karaf 3.0.2 server via SSH to
> reset the environment prior to making WebService calls to the server.
> After upgrading from Karaf 2.3.4 I started noticing
> "java.lang.OutOfMemoryError: Java heap space” errors. In looking around
> I noticed 60,000+
> org.apache.karaf.shell.security.impl.SecuredCommandProcessorImpl objects
> in the HeapDump when the Karaf server had only run a few rounds of testing.
>
> 1) Although I have searched without finding a definitive answer, Is this
> a known issue?
>
> 2) I am using the default Karaf 3.0.2 installation with cxf-jaxbws and
> some custom bundles. In addition to the attached screen image from the
> Eclipse Memory Analyzer, what additional information should I provided?
>
> ***
> * Code to programmatically connect to Karaf via ssh and issue reset
> commands.
> ***
> String host = “localhost”;
> int port = 8101;
> String user = "karaf";
> String password = "karaf";
>
> SshClient client = null;
> String line = null;
> try {
> client = SshClient.setUpDefaultClient();
> client.start();
> ConnectFuture future = client.connect(user, host, port);
> future.await();
> ClientSession session = future.getSession();
> session.addPasswordIdentity(password);
> session.auth().verify();
> ClientChannel channel = session.createExecChannel(command);
> InputStream is = new FileInputStream("/dev/null");
> PipedInputStream pi = new PipedInputStream();
> PipedOutputStream po = new PipedOutputStream(pi);
> InputStreamReader isr = new InputStreamReader(pi);
> LineNumberReader lr = new LineNumberReader(isr);
> channel.setIn(is);
> channel.setOut(po);
> channel.setErr(System.err);
> channel.open();
> channel.waitFor(ClientChannel.CLOSED, 0);
> line = lr.readLine();
>
> lr.close();
> is.close();
> } catch (InterruptedException e) {
> e.printStackTrace();
> throw e;
> } catch (IOException e) {
> e.printStackTrace();
> throw e;
> } catch (Exception e) {
> e.printStackTrace();
> throw e;
> } finally {
> client.stop();
> }
>
>
> Paul Spencer
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com