Closed raverin7 closed 1 month ago
Hello @raverin7,
Thank you for reporting the issue. We will investigate.
Filed internally as 245014
Hello @raverin7,
It is unclear why the request triggers the timeout in these conditions, but it is clear that it does, so I am changing our underlying event source to ensure that each connection can only 'fail' a single time.
Additionally I did a release today that ensures that our exponential backoff logic is being applied, which helps to mitigate this until the event source changes are released.
Thank you, Ryan
@raverin7 This should be fixed in version 9.4.3.
Thank you for the report and detailed observations!
Describe the bug Containarized application keeps consuming memory until OOMKilled, when there is no internet connectivity. It is a result of two event handlers (one for timeout and one for error) being invoked on a single reconnection attempt, and each of them produces another reconnection, and so on.
To reproduce Environment:
Windows 10 with WSL: WSL version: 2.1.5.0 Kernel version: 5.15.146.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.4291
Ubuntu installed in WSL:
Docker Engine installed on Ubuntu Docker version 26.1.1, build ac2de55
and Contaiarized Application is run on Docker. Its base image is node:20.9.0-alpine3.17
So we have: Windows 10 (WSL) -> Ubuntu 24.04 (Docker) -> Containarized Application (Base image: node:20.9.0-alpine3.17)
For reproduction purposes I have prepared simple test project with application that creates LDClient and then waits 5 minutes.
index.js
Dockerfile
package.json
Build image:
sudo docker build . -t testproject
Disable internet acces either from Windows: Go to the taskbar and clik disconnect on the interface that provides internet or from Ubuntu 24.04:
sudo ip link set <internet-access-interface> down
and run containerized application:sudo docker run testproject
or just run containerized application without network:
sudo docker run --network none testproject
One can monitor memory usage with:
docker stats
. Please observe that memory usage keeps increasing. Containarized application completes after 5 minutes and prints initial and final memory usage.This is the simplest, fastest way to show retry mechanism that keeps consuming more and more memory.
The other scenarios would be to run the application to successfully connect to LaunchDarkly and then disconnect internet, but in that case one would have to wait 300 000 ms (config.readTimeoutMillis) for the issue to start happening.
In case of internet disconnect for more than 5 minutes and then reconnection, LD Client might store number of streams at a time.
Expected behavior Reconnect mechanism in case of broken internet access does not spawn two connection attempts at a time, but only one.
Logs Please find here snippet of logs from begging and end of aforementioned application being ran.
My observations:
SDK version
Language version, developer tools Base image: node:20.9.0-alpine3.17
OS/platform Please read reproduction paragraph: Windows 10 (WSL) -> Ubuntu 24.04 (Docker) -> Containarized Application (Base image: node:20.9.0-alpine3.17)
Additional context One can add a log printing instance of req in launchdarkly-eventsource eventsource.js:connect() in handlers for timeout and error events. In such logs it should be visible that both of them are invoked from single connection attempt leading to snowballing: