Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: Potential leak in sleep.go #2482

Closed
3 tasks done
hhheiaenia opened this issue May 28, 2023 · 5 comments · Fixed by #2488
Closed
3 tasks done

🐛 [Bug]: Potential leak in sleep.go #2482

hhheiaenia opened this issue May 28, 2023 · 5 comments · Fixed by #2488

Comments

@hhheiaenia
Copy link

Bug Description

I notice the ctx.Done() needs a cancel function to unblock the statement of ctx.Done in https://github.com/gofiber/fiber/blob/master/internal/gopsutil/common/sleep.go#L13, since the case may block forever if the case not met.
I was wondering if this may leak the goroutine where the ctx.Done() locates?

Maybe what I said is not right, thank you for taking a look.

How to Reproduce

.

Expected Behavior

.

Fiber Version

v2.40.1

Code Snippet (optional)

package main

import "github.com/gofiber/fiber/v2"
import "log"

func main() {
  app := fiber.New()

  // Steps to reproduce

  log.Fatal(app.Listen(":3000"))
}

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.
@welcome
Copy link

welcome bot commented May 28, 2023

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@gaby
Copy link
Member

gaby commented May 28, 2023

@hhheiaenia Have you asked in the gopsutil repo? Their sleep.go hasn't change in years.

https://github.com/shirou/gopsutil/blob/master/internal/common/sleep.go

@hhheiaenia
Copy link
Author

yes, here are their fixing link: shirou/gopsutil#1475

@luk3skyw4lker
Copy link
Contributor

Taking the issue!

@gaby
Copy link
Member

gaby commented May 31, 2023

@luk3skyw4lker :-) thanks!

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

Successfully merging a pull request may close this issue.

3 participants