Description
GeoServer closes WMS service API with HTTP Basic authentication.
GWC sends internal request to WMS without credentials (if they are not configured) and also is not able to authenticate against WMS service..
WMSHttpHelper.connectAndCheckHeaders throws Service Exception (because WMS service responds with 401):
if (responseCode != 200 && responseCode != 204) {
tileRespRecv.setError();
throw new ServiceException(
"Unexpected response code from backend: "
+ responseCode
+ " for "
+ wmsBackendUrl.toString());
}
So, in this workflow an allocated (from the pool) HTTP connection is never released back to the pool.
By default 2 connections are per HTTP route (is is also questionable, shouldn't we allow more for internal GWC-WMS communication?)
So, connections are taken from the pool and never returned. All subsequent connections will wait pool without timeout.. (timeone is alos needed for internal connections).
AN easy fix is to put all content of connectAndCheckHeaders into try{}finally{}:
Something like this (tried quickly and locking problem is gone at least, regardless workflow connection is returned to the pool):
Activity