Fix tls_connection shutdown cleanup #163
Closed
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.
The SSL library maintains an internal table of CA certificates
(ssl_otp_cacertificate_db). This is supposed to be cleaned up when the
last connection using a certificate closes, however there's two problems
in R16B02 (and in the current master branch on github):
filename (ie, #ssl_options.cacerts is set, but #ssl_options.cacertfile
is undefined) the cleanup never occurs due to an incorrect pattern
match in tls_connection:handle_trusted_certs_db/1. This causes the
table to grow unchecked because each connection adds a new entry.
called because the trap_exit process flag is not set and so similarly
the table (and everything else cleaned in terminate/1, for that
matter) is not cleaned up. This doesn't affect "normal" termination
caused by the connection closing because terminate/1 is called
explicitly from handle_sync_event/4, rather that relying on gen_fsm's
automatic calling.