Skip to content

[TT-10153] Memory Leak fix#31

Open
mativm02 wants to merge 4 commits intomainfrom
fix/memory-leak
Open

[TT-10153] Memory Leak fix#31
mativm02 wants to merge 4 commits intomainfrom
fix/memory-leak

Conversation

@mativm02
Copy link
Contributor

@mativm02 mativm02 commented Oct 4, 2023

Description

Now we're using a Singleton to generate new HTTP handlers. This will help us to avoid memory leaks due to the multiple creation of http.Handler objects.

Related Issue

https://tyktech.atlassian.net/browse/TT-10153?atlOrigin=eyJpIjoiYmY2YzE3OWNhNjE2NDliMGI3YmQzYTU4YTU0ZDdhMTEiLCJwIjoiaiJ9

Motivation and Context

https://community.tyk.io/t/increasing-memory-usage-after-5-2-upgrade/6731

Test Coverage For This Change

Screenshots (if appropriate)

Types of changes

  • 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)
  • Documentation updates or improvements.

Checklist

  • I have reviewed the guidelines for contributing to this repository.
  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If PRing from your fork, don't come from your master!
  • Make sure you are making a pull request against our master branch (left side). Also, it would be best if you started your change off our latest master.
  • My change requires a change to the documentation.
    • I have manually updated the README(s)/documentation accordingly.
    • If you've changed APIs, describe what needs to be updated in the documentation.
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • When updating library version must provide reason/explanation for this update.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • gofmt -s -w .
    • go vet ./...

@mativm02 mativm02 requested a review from tbuchaillot October 4, 2023 15:00
@mativm02 mativm02 changed the title Memory Leak fix [TT-10153] Memory Leak fix Oct 4, 2023
Copy link
Collaborator

@tbuchaillot tbuchaillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@tbuchaillot tbuchaillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a big problem with this approach - we actually need multiple HTTP handler for each API since we are setting different attributes for each handler ( like api_id, org_id, etc).
We need to continue investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants