-
Notifications
You must be signed in to change notification settings - Fork 373
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
- use golang context pkg instead of gorilla/context to fix memory leaks #175
Conversation
This change won't work with golang versions below 1.7 as the context pkg did not exist for those versions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of last requests, @secracon -
- Update
doc.go
to remove reference to the memory leak from the old context implementation - https://github.com/gorilla/sessions/blob/master/doc.go#L62 - The same again in
README.md
https://github.com/gorilla/sessions/blob/master/README.md#L62 - Update
.travis.yml
to only build from Go 1.7.x onwards
Let me know if you need me to pick this up if you're unable to find time.
Thanks @secracon! |
You're welcome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The go.mod file still references github.com/gorilla/context. Did you run go mod tidy?
Hi @elithrar, will there be a tagged release with this change? The latest tag Reason being is that as a consumer I want to avoid locking down to a commit and rely on semver instead so my dep manager does the heavy lifting. |
I think @elithrar will release a minor version when he can find time. |
If gorilla/sessions is used together with other solutions including gorilla/mux, then there is a big chance of memory leaks, because the request may change during it's lifetime due to shallow copying of the request when the request context is changing. Once the request is copied, and that copy is used instead, then the request can no longer be found as key in the global context store managed by gorilla/context. This way the expired contexts are remaining in memory forever.