Skip to content

🐛 fix: treat case for possible timer memory leak#2488

Merged
ReneWerner87 merged 1 commit intogofiber:masterfrom
luk3skyw4lker:fix/sleep-memory-leak
May 31, 2023
Merged

🐛 fix: treat case for possible timer memory leak#2488
ReneWerner87 merged 1 commit intogofiber:masterfrom
luk3skyw4lker:fix/sleep-memory-leak

Conversation

@luk3skyw4lker
Copy link
Copy Markdown
Contributor

@luk3skyw4lker luk3skyw4lker commented May 31, 2023

Description

It was reported in the gopsutil a possible memory leak for the Sleep function, the fix is to in case of the timer being cancelled by the context, checking if the timer isn't stopped and stoping it.

Fixes #2482

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • For new functionalities I follow the inspiration of the express js framework and built them similar in usage
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation - /docs/ directory for https://docs.gofiber.io/
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • If new dependencies exist, I have checked that they are really necessary and agreed with the maintainers/community (we want to have as few dependencies as possible)
  • I tried to make my code as fast as possible with as few allocations as possible
  • For new code I have written benchmarks so that they can be analyzed and improved

Commit formatting:

Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/

@welcome
Copy link
Copy Markdown

welcome Bot commented May 31, 2023

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@sixcolors sixcolors requested review from Fenny and sixcolors May 31, 2023 01:47
@gaby gaby requested review from ReneWerner87, efectn and gaby and removed request for Fenny May 31, 2023 01:57
@gaby
Copy link
Copy Markdown
Member

gaby commented May 31, 2023

This is an upstream fix from here: shirou/gopsutil#1475

Copy link
Copy Markdown
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

LGTM

@gaby
Copy link
Copy Markdown
Member

gaby commented May 31, 2023

Thanks! @luk3skyw4lker

Copy link
Copy Markdown
Member

@sixcolors sixcolors left a comment

Choose a reason for hiding this comment

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

@ReneWerner87 ReneWerner87 merged commit 5d53263 into gofiber:master May 31, 2023
@welcome
Copy link
Copy Markdown

welcome Bot commented May 31, 2023

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@luk3skyw4lker luk3skyw4lker deleted the fix/sleep-memory-leak branch June 2, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: Potential leak in sleep.go

5 participants