Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error closing client when LaunchDarkly relay proxy in daemon mode #118

Closed
benpagedelphix opened this issue Apr 8, 2019 · 2 comments
Closed

Comments

@benpagedelphix
Copy link

Describe the bug
Using LaunchDarkly relay proxy in daemon mode (use_ldd=True) causes the following error whenever the client is closed.

'LDClient' object has no attribute '_update_processor': AttributeError
Traceback (most recent call last):
...
    client.close()
  File "/var/task/ldclient/client.py", line 160, in close
    if self._update_processor and self._update_processor.is_alive():
AttributeError: 'LDClient' object has no attribute '_update_processor'

Note that this can also be triggered by calling ldclient.set_config(config).

The issue is that because we are running in daemon mode, the _update_processor attribute for the client was never set. The following lines from ldclient.client.LDClient#__init__ capture this.

if self._config.use_ldd:
            log.info("Started LaunchDarkly Client in LDD mode")
            return

but the _update_processor attribute is not set until later in the object initialization.

To reproduce

Create a client with a config that has use_ldd set to True and try to call close on that client.

Expected behavior

The client should close the connection without an issue.

Logs

'LDClient' object has no attribute '_update_processor': AttributeError
Traceback (most recent call last):
...
ldclient.set_config(config)
File "/var/task/ldclient/__init__.py", line 47, in set_config
old_client.close()
File "/var/task/ldclient/client.py", line 160, in close
if self._update_processor and self._update_processor.is_alive():
AttributeError: 'LDClient' object has no attribute '_update_processor'

SDK version
6.8.4

Language version, developer tools
Python 3.6

Additional context
I discovered this while using the SDK in a lambda function. Even though it was a new call to the lambda, calling ldclient.set_config caused the client from the previous run to try to close, which caused this issue.

@eli-darkly
Copy link
Contributor

Thanks for pointing this out! We'll have a patch out ASAP, although our fix may be slightly different from your PR.

@eli-darkly
Copy link
Contributor

This should work correctly in the latest release, 6.9.0. Sorry about the inconvenience.

LaunchDarklyCI pushed a commit that referenced this issue Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants