Skip to content

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

Open
@RogerZhongAWS

Description

@RogerZhongAWS

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);
                    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions