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

Avoid a memory leak in Excon #1167

Merged
merged 1 commit into from
Oct 30, 2017
Merged

Conversation

alan
Copy link
Contributor

@alan alan commented Oct 27, 2017

Current version of Excon has a memory leak when threads using an Excon
connection get destroyed.

Applies same fix as
ministryofjustice/prison-visits-public#346

The memory leak in pvb2 is slower because Puma is configured to use less threads
so they probably get recycled less often.

Also sets a constant number of threads for Puma in production as we do in
pvb-public.

@alan alan temporarily deployed to pvb-staff-pr-1167 October 27, 2017 09:42 Inactive
# connection object to the Nomis API for each Thread. This is to make an
# Excon connection thread safe.
#
# For example if Puma runs with 4 threads, and those threads reuse a
Copy link
Contributor

@StupidCodeFactory StupidCodeFactory Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and those threads reusing"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my version is right. @KPobeeNorris can you clarify the English grammar rules in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that Alan's original comment is the correct case; just need to change the spelling of 'effectively'.

#
# This cache is unnecessary in our case since:
# - we ensure thread safety by using a connection pool
# - we end up opening more sockets than necessary (25 vs 5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide more details, this isn't really clear why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better?

@alan alan temporarily deployed to pvb-staff-pr-1167 October 27, 2017 11:11 Inactive
@alan alan temporarily deployed to pvb-staff-pr-1167 October 27, 2017 11:12 Inactive
@alan alan temporarily deployed to pvb-staff-pr-1167 October 30, 2017 09:24 Inactive
Current version of Excon has a memory leak when threads using an Excon
connection get destroyed.

Applies same fix as
ministryofjustice/prison-visits-public#346

The memory leak in pvb2 is slower because Puma is configured to use less threads
so they probably get recycled less often.

Also sets a constant number of threads for Puma in production as we do in
pvb-public.
@StupidCodeFactory StupidCodeFactory merged commit 2692c1a into master Oct 30, 2017
@StupidCodeFactory StupidCodeFactory deleted the avoid-excon-memory-leak branch October 30, 2017 10:29
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

3 participants