launchdarkly / node-server-sdk

LaunchDarkly Server-side SDK for Node
Other
79 stars 65 forks source link

SDK returning stale feature flag values after a while #202

Closed shovelend closed 3 years ago

shovelend commented 3 years ago

Describe the bug We have been using the LaunchDarkly node-server-sdk in a server-side app for a few years now at our company. In the past couple of months we noticed a strange behaviour: After the app has been running for a few weeks some feature flags keep returning their previous(stale) values after an update from the LaunchDarkly dashboard. We could not get to the bottom of this problem yet, it can not be reproduced easily either.

We have added the following to the LaunchDarkly initialization, but we are waiting for this issue to happen again before we can examine the logs.

client.once('failed', (err) => {
      ldLogger.fatal(`Fatal error when initialising the LaunchDarkly client: ${err}`);
    });

client.on('error', (err) => {
      ldLogger.error(`Error happened when talking to LaunchDarkly: ${err}`);
});

We are wondering if we could act on anything in the meantime. Is there a known issue in the SDK, or has anyone seen a similar issue before?

To reproduce Intermittent, can't reproduce this deliberately.

Expected behavior The LaunchDarkly node-server-sdk should return the current value of a feature flag instead of the stale value.

SDK version 5.13.3

Language version, developer tools Node.js 15.3.0.

OS/platform Kubernetes v1.19.1 running on Ubuntu 20.04 LTS

bwoskow-ld commented 3 years ago

Hi @shovelend ,

To better diagnose this issue I'm going to have to refer you to our support team. You can reach them by emailing support@launchdarkly.com. With the support team you'll be able to securely share useful information to determine the cause, such as your account id, SDK configuration code snippet, SDK logs, or anything else which may be useful -- items which aren't necessarily appropriate on the public GitHub issue tracker.

Generally when one of the LaunchDarkly SDKs serves stale flags it is indicative of an SDK issue connecting to LaunchDarkly's services (or if you're optionally using the Relay Proxy, to there). If this was the case then you should see some messages in the logs about the SDK failing to connect to LaunchDarkly. However, if it is the case that some flag updates are propagating to the SDK but not others, then this would be puzzling to me.

Either way, contact our support team for further help.

Cheers, @bwoskow-ld

pvincentgf commented 3 years ago

Hey there, flagging that we have seen similar behaviour happening when the SDK is running in an application that isn't restarted in a number of days.

eli-darkly commented 3 years ago

@pvincentgf If you're seeing this, please contact support. Just saying that updates are not working is not enough information for us to go on; that's a very general symptom which could be due to either an SDK issue or a network/environment issue. The support team can work with you to investigate further, as @bwoskow-ld said above; when you contact them, please include any log output that you have from the SDK, since that is the most likely place to see any relevant error messages.