[TT-9972] release resources only after specs are completely switched during hot reload#5535
Merged
jeffy-mathew merged 1 commit intoApr 10, 2024
Conversation
titpetric
reviewed
Sep 5, 2023
titpetric
approved these changes
Sep 5, 2023
jeffy-mathew
marked this pull request as ready for review
September 5, 2023 06:44
|
Kudos, SonarCloud Quality Gate passed! |
Contributor
|
API tests result: success ✅ |
jeffy-mathew
force-pushed
the
feat/TT-9972/release-resources-after-switch-over
branch
from
April 10, 2024 13:15
b7333be to
5815a53
Compare
Contributor
|
API Changes no api changes detected |
|
jeffy-mathew
deleted the
feat/TT-9972/release-resources-after-switch-over
branch
April 10, 2024 14:38
Contributor
Author
|
/release to release-5.3 |
|
Working on it! Note that it can take a few minutes. |
tykbot Bot
pushed a commit
that referenced
this pull request
Apr 10, 2024
…during hot reload (#5535) <!-- Provide a general summary of your changes in the Title above --> ## Description release resources only after specs are completely switched during hot reload ## Related Issue https://tyktech.atlassian.net/browse/TT-9972 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why (cherry picked from commit ebe349c)
7 tasks
|
@jeffy-mathew Succesfully merged PR |
jeffy-mathew
added a commit
that referenced
this pull request
Apr 11, 2024
…are completely switched during hot reload (#5535) (#6222) ## **User description** [TT-9972] release resources only after specs are completely switched during hot reload (#5535) <!-- Provide a general summary of your changes in the Title above --> ## Description release resources only after specs are completely switched during hot reload ## Related Issue https://tyktech.atlassian.net/browse/TT-9972 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why [TT-9972]: https://tyktech.atlassian.net/browse/TT-9972?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ___ ## **Type** bug_fix ___ ## **Description** - Ensured that `HTTPTransport` is explicitly set to `nil` after closing idle connections to fully release API spec resources. - Modified the API loading logic to delay the release of old API specs until after the new specs have been fully loaded and swapped. This change aims to prevent issues that could arise from prematurely releasing resources during hot reloads. ___ ## **Changes walkthrough** <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>api_definition.go</strong><dd><code>Ensure HTTPTransport is Reset on API Spec Release</code> </dd></summary> <hr> gateway/api_definition.go <li>Added a line to set <code>HTTPTransport</code> to <code>nil</code> after closing idle <br>connections in the <code>Release</code> method. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6222/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_loader.go</strong><dd><code>Improve Resource Release Process During API Reload</code> </dd></summary> <hr> gateway/api_loader.go <li>Modified the API loading process to collect specs that need to be <br>released, releasing them after the API swap to prevent premature <br>resource release.<br> <li> Ensured that <code>curSpec</code> is not nil before attempting to release it. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6222/files#diff-cdf0b7f176c9d18e1a314b78ddefc2cb3a94b3de66f1f360174692c915734c68">+7/-2</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > ✨ **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions Co-authored-by: Jeffy Mathew <[email protected]>
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.











Description
release resources only after specs are completely switched during hot reload
Related Issue
https://tyktech.atlassian.net/browse/TT-9972
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist