-
Notifications
You must be signed in to change notification settings - Fork 264
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the bug
OPAL client experiences a progressive memory leak that causes memory utilization to increase by approximately 10% every time the client reconnects to the OPAL server. The memory never decreases after the reconnection, leading to unbounded memory growth over time.
The memory spike occurs immediately after "Performing data configuration, reason: Initial load" log message.
To Reproduce
Our opal-client and server are deployed in ECS (18 client tasks, 2 server tasks). From time to time (happens periodically, but inconsistently - can be every hour or every 10 hours):
- opal-server closes the connection with opal-client
- opal-client reconnects to opal-server and downloads the initial data (log:
Performing data configuration, reason: Initial load) - opal-client memory increases ~10%
OPAL-server env variables
{
"name": "OPAL_BROADCAST_URI",
"value": "kafka://..."
},
{
"name": "KAFKA_SECURITY_PROTOCOL",
"value": "SASL_SSL"
},
{
"name": "KAFKA_SASL_MECHANISM",
"value": "SCRAM-SHA-512"
},
{
"name": "KAFKA_PLAIN_USERNAME",
"valueFrom": "{FROM-SECRETS}"
},
{
"name": "KAFKA_PLAIN_PASSWORD",
"valueFrom": "{FROM-SECRETS}"
},
{
"name": "UVICORN_NUM_WORKERS",
"value": "4"
},
{
"name": "OPAL_REPO_WATCHER_ENABLED",
"value": "false"
},
{
"name": "OPAL_DATA_CONFIG_SOURCES",
"value": "{\"config\":{\"entries\":[{\"url\":\"http://identity.local/api/users\",\"config\":{\"fetcher\":\"HttpFetchProvider\",\"topics\":[\"policy_data\"],\"dst_path\":\"users\"}]}}"
},
{
"name": "OPAL_LOG_SERIALIZE",
"value": "TRUE"
},
{
"name": "DD_TRACE_ENABLED",
"value": "false"
}OPAL-client env variables
{
"name": "OPAL_SERVER_URL",
"value": "http://opal-server.local"
},
{
"name": "OPAL_INLINE_OPA_LOG_FORMAT",
"value": "http"
},
{
"name": "OPAL_POLICY_UPDATER_ENABLED",
"value": "false"
},
{
"name": "OPAL_FETCH_PROVIDER_MODULES",
"valueFrom": "opal_common.fetcher.providers"
}OPAL Server Logs
Nov 14 06:01:45.059 i-057b4106e35082453 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 06:01:36.931 i-057b4106e35082453 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 06:01:00.061 i-057b4106e35082453 opal-server 10.0.3.92:27014 - "GET /data/config HTTP/1.1" 200
Nov 14 06:01:00.061 i-057b4106e35082453 opal-server Serving source configuration
Nov 14 06:01:00.058 i-057b4106e35082453 opal-server 10.0.3.92:27006 - "GET /data/config HTTP/1.1" 200
Nov 14 06:01:00.057 i-057b4106e35082453 opal-server Serving source configuration
Nov 14 06:01:00.057 i-057b4106e35082453 opal-server 10.0.1.69:63620 - "GET /data/config HTTP/1.1" 200
Nov 14 06:01:00.056 i-057b4106e35082453 opal-server Serving source configuration
Nov 14 06:01:00.052 i-008606528e3b4be48 opal-server 10.0.1.69:37956 - "GET /data/config HTTP/1.1" 200
Nov 14 06:01:00.052 i-008606528e3b4be48 opal-server Serving source configuration
Nov 14 06:01:00.049 i-057b4106e35082453 opal-server connection open
Nov 14 06:01:00.049 i-057b4106e35082453 opal-server Client connected
Nov 14 06:01:00.046 i-057b4106e35082453 opal-server connection open
Nov 14 06:01:00.046 i-057b4106e35082453 opal-server Client connected
Nov 14 06:01:00.043 i-008606528e3b4be48 opal-server connection open
Nov 14 06:01:00.043 i-008606528e3b4be48 opal-server Client connected
Nov 14 06:01:00.038 i-008606528e3b4be48 opal-server connection open
Nov 14 06:01:00.038 i-008606528e3b4be48 opal-server Client connected
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-server connection closed
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-server connection closed
Nov 14 06:01:00.036 i-008606528e3b4be48 opal-server Client disconnected - 3144 :: 926f6450d8174bddb87aebf89d6d8a7a
Nov 14 06:01:00.036 i-008606528e3b4be48 opal-server Client disconnected - 7312 :: edc10954ee744d5283d48e658206068b
Nov 14 06:01:00.036 i-057b4106e35082453 opal-server connection closed
Nov 14 06:01:00.036 i-057b4106e35082453 opal-server Client disconnected - 52992 :: 94f5c533af3d4025ade3385cc1baa214
Nov 14 06:01:00.030 i-008606528e3b4be48 opal-server connection closed
Nov 14 06:01:00.030 i-008606528e3b4be48 opal-server Client disconnected - 41702 :: 3e534fc898604c4cb4a98ef4a0650238
Nov 14 06:00:05.294 i-008606528e3b4be48 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 05:56:46.373 i-008606528e3b4be48 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 06:00:05.294 i-008606528e3b4be48 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 05:56:46.373 i-008606528e3b4be48 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
Nov 14 05:56:45.381 i-057b4106e35082453 opal-server Authenticated as ZTX5ILH3WW57CEUM via SCRAM-SHA-512
OPAL Client Logs
Nov 14 06:01:04.860 i-008606528e3b4be48 opal-client Sent response. PUT /v1/data/users -> 204
Nov 14 06:01:04.684 i-008606528e3b4be48 opal-client Received request. PUT /v1/data/users
Nov 14 06:01:04.662 i-0dd6e5eac040e388e opal-client Sent response. PUT /v1/data/users -> 204
Nov 14 06:01:04.532 i-0c1eaa111e87f8a30 opal-client Sent response. PUT /v1/data/users -> 204
Nov 14 06:01:04.465 i-0dd6e5eac040e388e opal-client Received request. PUT /v1/data/users
Nov 14 06:01:04.460 i-057b4106e35082453 opal-client Sent response. PUT /v1/data/users -> 204
Nov 14 06:01:04.332 i-0c1eaa111e87f8a30 opal-client Received request. PUT /v1/data/users
Nov 14 06:01:04.251 i-057b4106e35082453 opal-client Received request. PUT /v1/data/users
Nov 14 06:01:02.751 i-008606528e3b4be48 opal-client Saving fetched data to policy-store: source url='http://identity.local/api/users', destination path='/users'
Nov 14 06:01:02.486 i-0dd6e5eac040e388e opal-client Saving fetched data to policy-store: source url='http://identity.local/api/users', destination path='/users'
Nov 14 06:01:02.282 i-0c1eaa111e87f8a30 opal-client Saving fetched data to policy-store: source url='http://identity.local/api/users', destination path='/users'
Nov 14 06:01:02.093 i-057b4106e35082453 opal-client Saving fetched data to policy-store: source url='http://identity.local/api/users', destination path='/users'
Nov 14 06:01:00.064 i-008606528e3b4be48 opal-client Connected to PubSub server ws://opal-server.local/ws
Nov 14 06:01:00.063 i-008606528e3b4be48 opal-client Fetching data from url: http://identity.local/api/users
Nov 14 06:01:00.063 i-008606528e3b4be48 opal-client Triggering data update with id: 07ee779b5da542ce87f8f02bdbfe6b7a
Nov 14 06:01:00.061 i-057b4106e35082453 opal-client Connected to PubSub server ws://opal-server.local/ws
Nov 14 06:01:00.060 i-057b4106e35082453 opal-client Fetching data from url: http://identity.local/api/users
Nov 14 06:01:00.059 i-057b4106e35082453 opal-client Triggering data update with id: 3112c32649194c4c947986a97fbd04f4
Nov 14 06:01:00.059 i-0c1eaa111e87f8a30 opal-client Connected to PubSub server ws://opal-server.local/ws
Nov 14 06:01:00.058 i-0c1eaa111e87f8a30 opal-client Fetching data from url: http://identity.local/api/users
Nov 14 06:01:00.058 i-0c1eaa111e87f8a30 opal-client Triggering data update with id: 7957cf2509ae4819a47535a8a974fd27
Nov 14 06:01:00.057 i-008606528e3b4be48 opal-client Getting data-sources configuration from 'http://opal-server.local/data/config'
Nov 14 06:01:00.057 i-008606528e3b4be48 opal-client Performing data configuration, reason: Initial load
Nov 14 06:01:00.057 i-008606528e3b4be48 opal-client Connected to server
Nov 14 06:01:00.055 i-0dd6e5eac040e388e opal-client Connected to PubSub server ws://opal-server.local/ws
Nov 14 06:01:00.054 i-0dd6e5eac040e388e opal-client Fetching data from url: http://identity.local/api/users
Nov 14 06:01:00.054 i-0dd6e5eac040e388e opal-client Triggering data update with id: 2625087308014ae498f49ab05c26d2d9
Nov 14 06:01:00.053 i-057b4106e35082453 opal-client Getting data-sources configuration from 'http://opal-server.local/data/config'
Nov 14 06:01:00.053 i-057b4106e35082453 opal-client Performing data configuration, reason: Initial load
Nov 14 06:01:00.052 i-057b4106e35082453 opal-client Connected to server
Nov 14 06:01:00.052 i-0c1eaa111e87f8a30 opal-client Getting data-sources configuration from 'http://opal-server.local/data/config'
Nov 14 06:01:00.052 i-0c1eaa111e87f8a30 opal-client Performing data configuration, reason: Initial load
Nov 14 06:01:00.052 i-0c1eaa111e87f8a30 opal-client Connected to server
Nov 14 06:01:00.047 i-0dd6e5eac040e388e opal-client Getting data-sources configuration from 'http://opal-server.local/data/config'
Nov 14 06:01:00.047 i-0dd6e5eac040e388e opal-client Performing data configuration, reason: Initial load
Nov 14 06:01:00.047 i-0dd6e5eac040e388e opal-client Connected to server
Nov 14 06:01:00.037 i-057b4106e35082453 opal-client Trying server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-057b4106e35082453 opal-client Trying to connect to Pub/Sub server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-0c1eaa111e87f8a30 opal-client Trying server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-0c1eaa111e87f8a30 opal-client Trying to connect to Pub/Sub server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-0c1eaa111e87f8a30 opal-client Closing RPC client
Nov 14 06:01:00.037 i-0c1eaa111e87f8a30 opal-client Connection gracefully closed by server -- Trying to reconnect.
Nov 14 06:01:00.037 i-0c1eaa111e87f8a30 opal-client RPC Reader task was cancelled.
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client Trying server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client Trying to connect to Pub/Sub server - ws://opal-server.local/ws
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client Closing RPC client
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client Connection gracefully closed by server -- Trying to reconnect.
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client RPC Reader task was cancelled.
Nov 14 06:01:00.037 i-008606528e3b4be48 opal-client Disconnected from server
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client Closing RPC client
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client Connection gracefully closed by server -- Trying to reconnect.
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client RPC Reader task was cancelled.
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client Disconnected from server
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client Closing RPC client
Nov 14 06:01:00.036 i-057b4106e35082453 opal-client Connection was terminated.
Nov 14 06:01:00.036 i-0c1eaa111e87f8a30 opal-client Disconnected from server
Nov 14 06:01:00.036 i-0c1eaa111e87f8a30 opal-client Closing RPC client
Nov 14 06:01:00.036 i-0c1eaa111e87f8a30 opal-client Connection was terminated.
Nov 14 06:01:00.036 i-008606528e3b4be48 opal-client Closing RPC client
Nov 14 06:01:00.036 i-008606528e3b4be48 opal-client Connection was terminated.
Nov 14 06:01:00.031 i-0dd6e5eac040e388e opal-client Trying server - ws://opal-server.local/ws
Nov 14 06:01:00.031 i-0dd6e5eac040e388e opal-client Trying to connect to Pub/Sub server - ws://opal-server.local/ws
Nov 14 06:01:00.031 i-0dd6e5eac040e388e opal-client Closing RPC client
Nov 14 06:01:00.030 i-0dd6e5eac040e388e opal-client Connection gracefully closed by server -- Trying to reconnect.
Nov 14 06:01:00.030 i-0dd6e5eac040e388e opal-client RPC Reader task was cancelled.
Nov 14 06:01:00.030 i-0dd6e5eac040e388e opal-client Disconnected from server
Nov 14 06:01:00.030 i-0dd6e5eac040e388e opal-client Closing RPC client
Nov 14 06:01:00.030 i-0dd6e5eac040e388e opal-client Connection was terminated.
OPAL-client memory increase at the same time the reconnection happens (Nov 14 06:01)
Expected behavior
- Memory should not accumulate across multiple reconnection events, as old data structures should be garbage collected after being replaced with new data
- OPAL server and client disconnect randomly/inconsistently without apparent reason, which should not happen
OPAL version
- Version: 0.9.0
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested