Open
Conversation
Author
|
to be clear on why i'm putting the PR here:
|
Author
|
the weaken resulted in a crash on certain csrs, deep clone seems to fix it, will provide a test and changed fix later |
this was two different leaks rolled into one, which i will explain below. i also have to note the test still leaks *some* objects, but i don't have the time to do full analysis on that modules used to diagnose the leaks: Net::Prometheus, Devel::Gladiator, Devel::FindRef, Devel::Cycle openxpki#1 is the globals in the parser holding on to things normally deciding when to clean these up could be a little tricky, but the parsing appears to be contained entirely within the _new method, so we can declare them local and have perl reset them at the end of scope optimally Convert::ASN1 would take care of this so they're deleted after they're needed; as well as instanced per object or creation of new parsers guarded while one is currently active openxpki#2 is PKCS10 creating the object, running ->find on it, which returns a *shallow* copy with a reference to a config hash in the original object, then puts said shallow copy into the config hash of the original object, which creates a cycle at first i thought weaken would be the more appropriate option here, but that simply crashed on trying to parse certain certs, so a deep clone is used and seems to fix the issue
Author
|
updated the patch after trying the previous iteration in our production system weakening the result of ->find caused crashes in some parses, so i switched it to deep-cloning which also seems to fix the leaks, but doesn't break any parsing as far as i can tell added a test for that too |
Author
|
This is still an issue and affects Crypt::X509 too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
this was two different leaks rolled into one, which i will explain below. i also have to note the test still leaks some objects, but i don't have the time to do full analysis on that
modules used to diagnose the leaks:
Net::Prometheus, Devel::Gladiator, Devel::FindRef, Devel::Cycle
#1 is the globals in the parser holding on to things
normally deciding when to clean these up could be a little tricky, but the parsing appears to be contained entirely within the _new method, so we can declare them local and have perl reset them at the end of scope
optimally Convert::ASN1 would take care of this so they're deleted after they're needed; as well as instanced per object or creation of new parsers guarded while one is currently active
#2 is PKCS10 creating the object, running ->find on it, which returns a shallow copy with a reference to a config hash in the original object, then puts said shallow copy into the config hash of the original object, which creates a cycle
i don't know whether a deep clone is appropriate there, so i just had the wrapping module weaken the reference to the config hash