restlet / restlet-framework-java

The first REST API framework for Java
https://restlet.talend.com
Other
654 stars 284 forks source link

Memory consumption error using the SSL Client connections #393

Open thboileau opened 12 years ago

thboileau commented 12 years ago

Initial ticket : http://restlet.tigris.org/issues/show_bug.cgi?id=1338

bperel commented 12 years ago

Hi,

When using the SSL Restlet extension, I noticed that calling a REST WebService fails after a (random ?) number of calls (usually 3 or 4). It looks like it's quite related to this bug, even though I'm not sure that in my case I'm facing a memory-related issue. Here is the trace I get :

5 avr. 2012 11:53:26 org.restlet.engine.connector.ClientConnectionHelper start INFO: Starting the internal [HTTPS/1.1] client 5 avr. 2012 11:53:26 org.restlet.engine.connector.ClientConnectionHelper start INFO: Starting the internal [HTTPS/1.1] client 5 avr. 2012 11:53:26 org.restlet.engine.connector.ClientConnectionHelper stop INFO: Stopping the internal[HTTPS/1.1] client 5 avr. 2012 11:53:26 org.restlet.engine.connector.BaseHelper$1 rejectedExecution ATTENTION: Unable to run the following client-side task: org.restlet.ext.ssl.internal.SslConnection$1@1020230 5 avr. 2012 11:54:26 org.restlet.resource.ClientResource retry INFO: A recoverable error was detected (1001), attempting again in 2000 ms. 5 avr. 2012 11:54:26 org.restlet.resource.ClientResource retry INFO: A recoverable error was detected (1001), attempting again in 2000 ms. 5 avr. 2012 11:54:26 org.restlet.engine.connector.Controller run ATTENTION: Unexpected error while controlling connector java.lang.NullPointerException at org.restlet.engine.connector.ConnectionHelper.checkin(ConnectionHelper.java:144) at org.restlet.engine.connector.ConnectionController.controlConnections(ConnectionController.java:96) at org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:154) at org.restlet.engine.connector.Controller.run(Controller.java:158) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) 5 avr. 2012 11:54:28 org.restlet.engine.connector.ClientConnectionHelper start INFO: Starting the internal [HTTPS/1.1] client 5 avr. 2012 11:54:28 org.restlet.engine.connector.ClientConnectionHelper stop INFO: Stopping the internal[HTTPS/1.1] client 5 avr. 2012 11:54:28 org.restlet.engine.connector.ClientConnectionHelper stop INFO: Stopping the internal[HTTPS/1.1] client 5 avr. 2012 11:54:28 org.restlet.engine.connector.ClientConnectionHelper start INFO: Starting the internal [HTTPS/1.1] client 5 avr. 2012 11:54:28 org.restlet.engine.connector.ClientConnectionHelper stop INFO: Stopping the internal[HTTPS/1.1] client 5 avr. 2012 11:54:28 org.restlet.engine.connector.BaseHelper$1 rejectedExecution ATTENTION: Unable to run the following client-side task: org.restlet.ext.ssl.internal.SslConnection$1@196c169

Here is the client code, using Restlet 2.1 RC3 : Request request = new Request(Method.GET, url); Context ctx = new Context(); ctx.getParameters().add("sslContextFactory","org.restlet.ext.ssl.DefaultSslContextFactory"); ctx.getParameters().add("keystorePath",cacertsLocation); ctx.getParameters().add("keystorePassword",keystorePassword); ctx.getParameters().add("keyPassword",keyPassword); ctx.getParameters().add("keystoreType","JKS"); ClientResource cr = new ClientResource(ctx, new Reference(url)); cr.setProtocol(Protocol.HTTPS); cr.setRequest(request); Representation rep = cr.get(); String result = rep.getText(); cr.release();

Do you have any clue concerning how to resolve this ? Please tell me if my problem has nothing to do with the original issue.

thboileau commented 12 years ago

Hello, by default a ClientResource issues several calls in case of errors. You can stop this behaviour by calling ClientResource#setRetryOnError(false).

Best regards, Thierry Boileau

bperel commented 12 years ago

Hi,

Thanks for your answer. However, not retrying the call in case of error doesn't resolve the error itself ;-)

Do you have any guess concerning the origin of this error ? ("Unable to run the following client-side task: org.restlet.ext.ssl.internal.SslConnection")

Best regards, Bruno Pérel

aymericTessier commented 12 years ago

Hi,

It seems that 2.1 RC4 does not include this issue's solution. Do you have any track concerning its origin (maybe somewhere where you think there can be a memory leak ?) and do you think you will make it for the RC5 ? I get this memory consumption error too and it's quite blocking for the rest of the project I'm in charge of. Maybe you're aware some kind of workaround ? Here's the log I get : https://gist.github.com/2366875

Thanks in advance for your answer.