launchdarkly / c-client-sdk

LaunchDarkly Client-side SDK for C/C++
Other
7 stars 15 forks source link

LDAllFlags returns nullptr if a flag is archived between calls #87

Closed arkhaix closed 1 year ago

arkhaix commented 2 years ago

Is this a support request? No.

Describe the bug During a single program instance, call LDAllFlags and it will work normally, then sleep for awhile. During that sleep, use the website to archive a flag (any flag). Now have the same program instance call LDAllFlags again and it will return null.

To reproduce Small standalone demo I used to reproduce this

Expected behavior LDAllFlags should not return null.

Logs Output of the program included in the gist above when I run it and archive a flag during the sleep period:

[LD_LOG_INFO] [.\launchdarklyclient-src\src\user.c, 39] Setting user key to: ...
[LD_LOG_INFO] [.\launchdarklyclient-src\src\ldnet.c, 517] connecting to stream https://clientstream.launchdarkly.com/meval/eyJrZXkiOiJ0ZXN0
LXVzZXItMSJ9
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldnet.c, 142] about to call connection handle callback
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldnet.c, 144] finished calling connection handle callback
initialized
getting variation
variation true
flags_json = 00000229263DCD20
Waiting 15 seconds...
[LD_LOG_WARNING] [.\launchdarklyclient-src\c-sdk-common\src\json.c, 93] LDJSONDuplicate NULL input
flags_json = 0000000000000000
closing
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldthreads.c, 57] bgsender running
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldthreads.c, 166] killing thread LDi_bgfeaturepoller
[LD_LOG_DEBUG] [.\launchdarklyclient-src\src\ldnet.c, 527] curl_easy_perform returned error code 56
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldthreads.c, 486] killing thread LDi_bgfeaturestreamer
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldthreads.c, 109] successfuly sent event batch
[LD_LOG_TRACE] [.\launchdarklyclient-src\src\ldthreads.c, 41] killing thread LDi_bgeventsender
closed

Process finished with exit code 0

SDK version 2.4.9

Language version, developer tools MSVC 2017

OS/platform Windows 10

Additional context Note that c-server-sdk with LDAllFlagsState does not exhibit this issue.

HakShak commented 2 years ago

Opened a support ticket for this as well: 23920

kinyoklion commented 2 years ago

Hello @arkhaix,

Version 2.5.1 of the SDK has been released which fixes this issue.

Thank you for the report and detailed reproduction steps.

Thank you, Ryan