Skip to content

Conversation

@hassox
Copy link

@hassox hassox commented Oct 31, 2014

When performing work in the thread pool, the thread pool has any thread variables left from the last time it was used.

evanphx added a commit that referenced this pull request Oct 31, 2014
Clean out a threads local data before doing work
@evanphx evanphx merged commit 9ece997 into puma:master Oct 31, 2014
@nathansamson
Copy link
Contributor

Would this solve any real world problems? Or is just to make sure it doesn't cause any issues?

@hassox
Copy link
Author

hassox commented Oct 31, 2014

It bit me with a small bug yesterday when using thread locals which is how I found it.

@bashcoder
Copy link

It appears that this patch helped me out a lot - thanks @hassox!

I am migrating from passenger enterprise to puma, and I have a Sinatra app that memoizes several datastore connections using Thread.current[] keys in singletons. I observed a steady growth in the thread count per cluster worker (far beyond the configured puma limits), and memory usage growth over time. My various datastores were also showing an increase in connections over time.

I'm still having a few threading issues to track down, and I'm sure I'm not properly handling a few things. But this PR has solved several of my issues.

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.

4 participants