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

Ensure we only add OpenSslEngine to the OpenSslEngineMap when handsha… #4653

Closed
wants to merge 1 commit into from

Commits on Jan 4, 2016

  1. Ensure we only add OpenSslEngine to the OpenSslEngineMap when handsha…

    …ke is started
    
    Motivation:
    
    We need to ensure we only add the OpenSslEngine to the OpenSslEngineMap when the handshake is started as otherwise we may produce a memory leak when the OpenSslEngine is created but not actually used. This can for example happen if we encounter a connection refused from the remote peer. In this case we will never remove the OpenSslEngine from the OpenSslEngineMap and so it will never be collected (as we hold a reference). This has as affect that the finalizer will never be run as well.
    
    Modifications:
    
    - Lazy add the OpenSslEngine to the OpenSslEngineMap to elimate possible leak.
    - Call OpenSslEngine.shutdown() when SslHandler is removed from the ChannelPipeline to free memory asap in all cases.
    
    Result:
    
    No more memory leak with OpenSslEngine if connection is refused.
    normanmaurer committed Jan 4, 2016
    2 Configuration menu
    Copy the full SHA
    6feb130 View commit details
    Browse the repository at this point in the history