-
Notifications
You must be signed in to change notification settings - Fork 3
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
Access violation issue while using LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL for HTTP and HTTPS proxy workaround #438
Comments
Hi @Mayank-Rk-Gupta , what I'm seeing in your screenshot is an Access Violation on line 78: mContext = LDContextBuilder_Build(mContextBuilder); This is likely not related to the Can you please show the code where you allocate your The proper way to create a Context would be (example): LDContextBuilder context_builder = LDContextBuilder_New();
LDContextBuilder_AddKind(context_builder, "user", "example-user-key");
LDContextBuilder_Attributes_SetName(context_builder, "user", "Mayank");
LDContext context = LDContextBuilder_Build(context_builder); |
Hi @cwaldren-ld, I started the implementation of my code without proxy and I am not getting any error in
I am getting the access violation in |
I think I see the issue from your screenshot. It looks like you are calling You can only call the builder methods on the In other words, this is correct: LDClientConfigBuilder mConfigBuilder = LDClientConfigBuilder_New("sdk-123");
LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL(mConfigBuilder, proxy.c_str());
LDClientConfig config;
LDStatus status = LDClientConfigBuilder_Build(mConfigBuilder, &config);
// Now you can pass the config to LDClientSDK_New.
// NOTE: You cannot access mConfigBuilder now, it was freed. This is not correct: LDClientConfigBuilder mConfigBuilder = LDClientConfigBuilder_New("sdk-123");
LDClientConfig config;
LDStatus status = LDClientConfigBuilder_Build(mConfigBuilder, &config);
// WARNING: This is undefined behavior!
// The mConfigBuilder object was already freed by C++ destructor on the previous line.
LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL(mConfigBuilder, proxy.c_str());
// Accessing it may cause a crash, or worse.
// You cannot call a configuration method after you have already built the config. |
Hi @cwaldren-ld, I tried
However when I LDClientSDK_Start to initiate the client sdk, using below code
it is getting failed to initialize the sdk and I test again without adding proxy, It is succesfully able to initiliaze the sdk. |
Hi @Mayank-Rk-Gupta , glad to hear the access violation is resolved. I suspect it is something to do with the proxy.
Please, redact any sensitive information if necessary. |
Is this a support request?
No
Describe the bug
I'm experiencing an access violation error while using the LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL for proxy configuration. This issue arises because LaunchDarkly v3 currently lacks direct support for proxy settings. Despite following the correct implementation steps, the error persists. I’ve attached a screenshot for reference to provide more context on the issue. Please investigate this matter furthe
To reproduce
See the attached screenshot
Expected behavior
Should not give me the access violation.
SDK version
3.6.3
Language version, developer tools
C++17 on Visual Studio 2022 ( Version 17.8.14).
OS/platform
Windows 10.
Additional context
Example code
The text was updated successfully, but these errors were encountered: