zamzterz/Flask-pyoidc

Keycloak connection being dropped

Closed this issue · 0 comments

fvde commented

We are seeing pretty weird behaviour, where the flask service fails to get an answer from Keycloak every now and then. It works most of the time, until it doesn't.

02-06-2024 10:03:08 AM ERROR:oic.oauth2.base:http_request failed: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')), url: https://our.domain.com/realms/master/protocol/openid-connect/token/introspect, htargs: {'allow_redirects': False, 'cert': None, 'verify': True, 'timeout': 5.0, 'data': 'token=<redacted_token>&token_type_hint=access_token', 'headers': {'Authorization': 'Basic <redacted_auth_header>', 'Content-Type': 'application/x-www-form-urlencoded'}}, method: POST

Possibly related issue:
The following issue seems to indicate, that Keycloak drops unused connections after 60 seconds. We see the above behaviour increasingly after periods of inactivity, so it fits our pattern.
marcospereirampj/python-keycloak#36

Versions:
keycloak 23.0.5

flask==2.3.3
Flask-pyoidc==3.14.2