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