<div dir="ltr"><div>Hi!</div><div><br></div><div>In my opinion they are two separate issues, but related to each other. KEYCLOAK-3016 describes a situation where this behavior can be reproduced. As a safety measure I&#39;d still define reasonable timeouts instead of waiting indefinitely after the issue has been fixed.</div><div><br></div><div>I&#39;m examining the testsuite to find the proper place for testing BasicAuthRequestAuthenticator error handling...</div><div><br></div><div>Best regards,</div><div>Thomas</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 9:47 AM, Stian Thorgersen <span dir="ltr">&lt;<a href="mailto:sthorger@redhat.com" target="_blank">sthorger@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I see you created <a href="https://issues.jboss.org/browse/KEYCLOAK-3016" target="_blank">https://issues.jboss.org/browse/KEYCLOAK-3016</a>. Is that the cause of this issue or are there potentially more issues here?</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 17 May 2016 at 15:21, Thomas Raehalme <span dir="ltr">&lt;<a href="mailto:thomas.raehalme@aitiofinland.com" target="_blank">thomas.raehalme@aitiofinland.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi!
<div><br></div><div>We have had a couple of strange issues where the HTTP connection pool for the HttpClient used by ServerRequest has been exhausted. Strange thing is, the thread dump on the JVM reports many threads waiting for a connection, but none actually using them.</div><div><br></div><div><div>&quot;http-apr-8080-exec-1&quot; #33 daemon prio=5 os_prio=0 tid=0x00007f5c3400b000 nid=0x723a waiting on condition [0x00007f5bff7f6000]</div><div>   java.lang.Thread.State: WAITING (parking)</div><div>        at sun.misc.Unsafe.park(Native Method)</div><div>        - parking to wait for  &lt;0x00000000eb3edac0&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)</div><div>        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)</div><div>        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)</div><div>        at org.apache.http.impl.conn.tsccm.WaitingThread.await(WaitingThread.java:159)</div><div>        at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:398)</div><div>        at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:298)</div><div>        at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:238)</div><div>        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423)</div><div>        at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)</div><div>        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)</div><div>        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)</div><div>        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)</div><div>        at org.keycloak.adapters.ServerRequest.invokeRefresh(ServerRequest.java:149)</div><div>        at org.keycloak.adapters.RefreshableKeycloakSecurityContext.refreshExpiredToken(RefreshableKeycloakSecurityContext.java:113)</div></div><div><br></div><div>I&#39;m still trying to figure out what&#39;s going on here, but while digging around I noticed that the HttpClientBuilder[1] does not set a timeout for obtaining a connection from the pool. Wouldn&#39;t it be a good idea to set one? Maybe 30s or so, just to avoid waiting indefinitely. The same applies to socket timeout as well.</div><div><br></div><div>[1] <a href="https://github.com/keycloak/keycloak/blob/1.9.4.Final/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java" target="_blank">https://github.com/keycloak/keycloak/blob/1.9.4.Final/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java</a></div><div><br></div><div>Best regards,</div><div>Thomas</div></div>
<br></div></div>_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br></blockquote></div><br></div>
</blockquote></div><br><br>
</div></div>