This repository has been archived by the owner on May 29, 2023. It is now read-only.
[fix]: memory leak in mod_dyups when ssl session reuse is enabled. #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, @yzprofile
Issue #67 open for a long time, this problem also appeared in our online environment recently. I see @RocFang fix it just skip
set_session
andsave_session
function in PR #141, but after that will make proxy ssl session reuse not work.So, I redesigned
set_session
andsave_session
function, the new solution will solve memory leak issue and keep ssl session reuse work:ssl_session
data in the upstream related variable, not pre request related variable such asdyups_ctx
, avoid losing after request complete.ssl_session
memory, it will destroy when free dynamic upstream or exit process.ngx_ssl_set_session(pc->connection, ssl_session)
success.Steps to reproduce memory leak issue:
case1: (keepalive or no keepalive)
curl -H "Host: dyhost" -d "server 127.0.0.1:8089;server 127.0.0.1:8088;" 127.0.0.1:8081/upstream/dyhost -v
for i in {1..10000}; do curl -H "host: dyhost" 127.0.0.1:8080 -v; d
case2: (keepalive or no keepalive)
for i in {1..10000}; do curl -H "Host: dyhost" -d "server 127.0.0.1:8089;server 127.0.0.1:8088;" 127.0.0.1:8081/upstream/dyhost -v; done
for i in {1..10000}; do curl -H "host: dyhost" 127.0.0.1:8080 -v; d