• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""
EXPAND ALL

EDIT ON GITHUB

Shutting down

Read time: 1 minute
Last edited: Nov 04, 2021

Overview

This topic explains how to safely shut down different LaunchDarkly SDKs. This feature is available for both client-side and server-side SDKs.

Shutting down an SDK

LaunchDarkly SDKs provide language-specific methods to shut down their instances safely.

In most applications, you do not have to manually shut down an SDK. However, when your application is about to terminate, you should shut down the LaunchDarkly client. This ensures that the client releases any resources it is using, and that it delivers any pending analytics to LaunchDarkly. If your application terminates without this shutdown step, you may not see your flag evaluations and users on the dashboard, because they are derived from analytics events.

Do not attempt to evaluate flags or otherwise use the LaunchDarkly client after it has shut down, as doing so may result in undefined behavior. Shut down the client at a point in your application's lifecycle where the client is no longer needed.

Details about each SDK's configuration are available in the SDK-specific sections below.

  • Client-side SDKs
  • Server-side SDKs

Client-side SDKs

This feature is available in the following client-side SDKs:

.NET (client-side)

To shut down:

1client.Dispose();

Android

To shut down:

1client.close();

C/C++ (client-side)

To fully uninitialize the C/C++ SDK resources, you must use close. The operation blocks until all resources are free.

To shut down:

1LDClientClose(client);

Electron

To shut down:

1await client.close();

Flutter

To shut down:

1await LDClient.close();

iOS

To shut down:

1client.close()

JavaScript

To shut down:

1await client.close();

Node.js (client-side)

To shut down:

1await client.close();

React Native

To shut down:

1await client.close();

Server-side SDKs

This feature is available in the following server-side SDKs:

.NET (server-side)

Dispose safely shuts down the client instance.

To shut down:

1client.Dispose();

C/C++ (server-side)

LDClientClose uninitializes the resources the C/C++ SDK uses. The operation blocks until all resources are free.

To shut down:

1LDClientClose(client);

Erlang

stop_instance(), stop_instance(Tag), and stop_all_instances() all safely shut down client instances and release the resources associated with them.

To shut down:

1ldclient:stop_all_instances()
2
3% Stops the default instance
4ldclient:stop_instance()
5
6% Stops a named instance
7ldclient:stop_instance(my_instance)

Go

To shut down:

1client.Close()

Haskell

To shut down:

1close client

Java

Close safely shuts down the client instance and releases all resources associated with the client.

To shut down:

1client.close()

Node.js (server-side)

To shut down:

1client.close();

Python

To shut down:

1ldclient.get().close()

Ruby

To shut down:

1client.close