fix(di): dynamic function discovery fallback [backport 2.21] #13998
+41
−3
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.
Backport b55f08f from #13947 to 2.21.
We implement a dynamic function discovery fallback when the function-from-code resolution via the GC fails. This can happen if the target application has interacted with the GC, e.g. by freezing it at a time that will prevent the current discovery from being able to resolve the function from the referenced code object.
Testing Strategy
The original issue was reproducible with a local deployment of synapse. The investigation led to the conclusion that the issue was caused by the way the application interacts with the GC https://github.com/element-hq/synapse/blob/1dc29563c1504a2523e467aa7bef6a7ac05cc60c/synapse/app/_base.py#L623C1-L629C35. Commenting out these lines makes the issue disappear. We have tested the fix against the unmodified application to verify that the proposed fix works.
Refs: DYNIS-28
Checklist
Reviewer Checklist