HomePhorge

(PUP-744) Ensure connections do not leak
e43a423c9f43Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-744) Ensure connections do not leak

Previously, the dummy and caching pools allowed the caller to take a
connection from the pool and retain ownership of the connection. This is
undesirable because if the caller encounters an exception while using
the connection, then they have to remember to close it, otherwise the
underlying socket will leak.

There is also the issue that a caller may forget to add it back to the
pool before the pool is closed, in which case the socket will again
leak.

This commit changes the api to a block form to ensure connections are
always returned to the pool or closed.

Note the reuse flag is used to ensure the connection is returned to
the pool even if the caller does a non-local return:

with_connection(..) { |conn| return }

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU8556529de5f2: (PUP-744) Create a pool of puppet HTTP connections
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPUe43a423c9f43: (PUP-744) Ensure connections do not leak (authored by Josh Cooper <josh@puppetlabs.com>).Jul 25 2014, 6:36 PM