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

Refactor needed: Fix resource leak by cleaning up used Secure Tunneling Contexts #443

Open
RogerZhongAWS opened this issue Dec 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@RogerZhongAWS
Copy link
Contributor

RogerZhongAWS commented Dec 12, 2023

Describe the bug

In SecureTunnelContext, we made a temporary fix for a segfault because we are trying to dereference a function pointer to onConnectionShutdown that no longer exists during the shutdown process. This change means that there is a resource leak as the SecureTunnelingContext will still reside in memory for the duration that the application is alive. While this is the lesser of two evils, a refactor is needed to bring Secure Tunneling fully in alignment with the rest of our features.

                    if (mProxyOptions.HostName.length() > 0) {
                        LOGM_INFO(TAG, "Creating Secure Tunneling with proxy to: %s", mProxyOptions.HostName.c_str());
                        return std::make_shared<SecureTunnelWrapper>(
                            mSharedCrtResourceManager->getAllocator(),
                            mSharedCrtResourceManager->getClientBootstrap(),
                            Crt::Io::SocketOptions(),
                            mProxyOptions,
                            mAccessToken,
                            AWS_SECURE_TUNNELING_DESTINATION_MODE,
                            mEndpoint,
                            mRootCa,
                            onConnectionComplete,
                            nullptr, // TODO: long term fix needed for onConnectionShutdown callback
                            onSendDataComplete,
                            onDataReceive,
                            onStreamStart,
                            onStreamReset,
                            onSessionReset);
                    }
@RogerZhongAWS RogerZhongAWS added the bug Something isn't working label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant