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

rack app is being re-initialised for every request #1323

Open
DangerDawson opened this issue Aug 14, 2023 · 0 comments
Open

rack app is being re-initialised for every request #1323

DangerDawson opened this issue Aug 14, 2023 · 0 comments

Comments

@DangerDawson
Copy link

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?

#1322

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

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

No branches or pull requests

1 participant