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é <[email protected]> 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é
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply via email to