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

Fix an issue where the rack app was being re-initialised for every request #1322

Open
wants to merge 1 commit into
base: 1.3.x
Choose a base branch
from

Conversation

DangerDawson
Copy link

@DangerDawson DangerDawson commented Aug 7, 2023

This took me a while to track down, but when we switched over to using memcached based seasions using the dalli gem we noticed that we were leaking memcache connections:

The culprit was this bit of code: https://github.com/petergoldstein/dalli/blob/main/lib/rack/session/dalli.rb#L70

As Hanami was re-initalising the app on every single request:

https://github.com/hanami/hanami/blob/1.3.x/lib/hanami/middleware_stack.rb#L52

Because the call method on for the rack builder was calling to_app on every request:

https://github.com/rack/rack/blob/da03bfab6497ab05e9ed795f5d3c033e47927483/lib/rack/builder.rb#L276

I am not sure if this is the correct way to fix this? or it was intended that the rack app should be re-initalised on every request?

Also I am not sure if this is present in Hanami v2 either

@parndt parndt changed the title Fix an issue where the rack app was being re-initialised for every re… Fix an issue where the rack app was being re-initialised for every request Oct 6, 2023
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.

None yet

1 participant