launchdarkly / c-client-sdk

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

Calling `saveFlags` in a callback doesn't work when Archiving a flag #90

Closed KOConchobhair closed 1 year ago

KOConchobhair commented 1 year ago

Is this a support request? No

Describe the bug I am seeing an application crash when calling client->saveFlags() inside a callback. I am using the client->registerFeatureFlagListenerWithClosure("*", ...) from #85 I believe this line is potentially problematic https://github.com/launchdarkly/c-client-sdk/blob/cdab1b5c08ef4a26f9e1b67a191230dad6a13823/src/flag.c#L213

To reproduce registerFeatureFlagListenerWithClosure("*", cb) cb callsclient->saveFlags()` Archive a flag in LD web UI

Expected behavior client->saveFlags() should return JSON (and not return NULL)

Logs

[/tmp/tmp.fDs9DSbBhG/c-client-sdk/c-sdk-common/src/json.c, 93] LDJSONDuplicate NULL input

SDK version 2.4.7

Language version, developer tools C++, gcc-10

OS/platform Ubuntu 18.04 LTS

Additional context I think this could be similar to #87 since there a check was added to check if !flag.deleted before calling LDJSONDuplicate(flag.value) but that's just a guess on my part

cwaldren-ld commented 1 year ago

Hi @KOConchobhair, thanks so much for filing this report. This will certainly need to be addressed.

Filed internally as 169687.

cwaldren-ld commented 1 year ago

Hi @KOConchobhair , this should be fixed by 2.5.2.

Please re-base the custom changes from #85 on that, and let me know if the issue is resolved.

cwaldren-ld commented 1 year ago

Hi @KOConchobhair , I'm closing this ticket. Please feel free to open a new one if the issue persists.