Fixes #4627: Move r31759 to v1.8 branch (Close the incoming socket if)

---svn-pre-commit-ignore-below---

r31759 [[BR]]
Close the incoming socket if we aren't going to accept it

cmr=v1.8.2:reviewer=rhc


r31763 [[BR]]
Just pick a module to handle the incoming connection if no direct interface is identified. Siegmar hit it because his IP/netmask is disjoint, but a router was able to make the connection.

Refs #4627
Fixes #4626: Move r31756, r31757 to v1.8 branch (btl/scif: make the exiting member)

---svn-pre-commit-ignore-below---

r31756 [[BR]]
btl/scif: fix hang at shutdown

scif_close is not causing scif_poll in the listening thread to return
as expected. To ensure the thread exits attempt to make a local
connection to wake up the thread before calling pthread_join.

cmr=v1.8.2:reviewer=ggouaillardet

r31757 [[BR]]
btl/scif: make the exiting member volatile

cmr=v1.8.2:ticket=#4626

r31772 [[BR]]
btl/scif: fix hang at shutdown

a brand new dummy connection has to be used to properly
trigger the main thread termination and avoid timeout in
the main thread

cmr=v1.8.2:reviewer=hjelmn
Fixes #4641: Move r31780 to v1.8 branch (btl/ugni: reorder teardown to avoid)

---svn-pre-commit-ignore-below---

r31780 [[BR]]
btl/ugni: reorder teardown to avoid using freed memory

vagrind correctly indicated that the mpool is needed when tearing down
the free lists. Reordered the teardown code to correct this.

My code so no review required.

cmr=v1.8.2:reviewer=ompi-rm1.8
Fixes #4633: Move r31770 to v1.8 branch (Fix memory leaks in orte/util/nidmap.c)

---svn-pre-commit-ignore-below---

r31770 [[BR]]
Fix memory leaks in orte/util/nidmap.c

This patch fixes four memory leaks in orte/util/nidmap.c :
 - hwloc_get_root_obj(opal_hwloc_topology)->userdata was never freed
 - even if bo->bytes is freed in the decode, bo was not freed
 - a job list is populated but never used nor freed

cmr=v1.8.2:reviewer=rhc
Fixes #4634: Move r31771 to v1.8 branch (Fix memory leak in mca_common_sm_rml_info_bcast(...))

---svn-pre-commit-ignore-below---

r31771 [[BR]]
Fix memory leak in mca_common_sm_rml_info_bcast(...)

The local buffer object is only used by the root of the group,
so move down the buffer declaration and initialization.

cmr=v1.8.2:reviewer=rhc
Fixes #4636: Move r31773 to v1.8 branch (Fix a memory leak in)

---svn-pre-commit-ignore-below---

r31773 [[BR]]
Fix a memory leak in orte_register_params()

mca_base_var_register (..., MCA_BASE_VAR_TYPE_STRING, ...)
will dup() the orte_set_slots string, so there is no need
to do this in the first place.

cmr=v1.8.2:reviewer=rhc
Fixes #4637: Move r31776 to v1.8 branch (orte: fix several small memory)

---svn-pre-commit-ignore-below---

r31776 [[BR]]
orte: fix several small memory leaks

grpcomm: fix memory leaks

We were leaking the caddy object used to pass data to the callback
function. This commit fixes these leaks.

oob,rml: fix memory leaks

This commit fixes several leaks:

 - Both the oob/base and oob/tcp were leaking objects on their peer
   hash tables. Iterate on the hash tables and free any objects.

 - Leaked sent messages because of missing OBJ_RELEASE. I placed the
   release in ORTE_RML_SEND_COMPLETE to catch all the possible
   paths.

ess/base: close the state framework

cmr=v1.8.2:reviewer=rhc
Fixes #4638: Move r31777 to v1.8 branch (opal: fix leaks)

NOTE: the part of this changeset that was supposed to apply to opal/mca/dstore/hash
could not be applied as that component does not exist in 1.8. Instead, it remains
in the opal/mca/db framework. A custom patch to move it across is required.


---svn-pre-commit-ignore-below---

r31777 [[BR]]
opal: fix leaks

Two leaks are fixed by this commit:

 - opal_dss.lookup_data_type returns an allocated string. Free it.

 - opal_ifaddrtokindex was leaking a struct addrinfo. Ensure that is
   released before returning.

cmr=v1.8.2:reviewer=rhc
Fixes #4640: Move r31779 to v1.8 branch (More leak fixes.)

---svn-pre-commit-ignore-below---

r31779 [[BR]]
More leak fixes.

Two leaks are fixed in this commit:

 - Do not leak btl component list items.

 - Do not leak the nodename when decoding the pidmap.

cmr=v1.8.2:reviewer=rhc
Fixes #4646: Move r31788 to v1.8 branch (Fix a memory leak in)

---svn-pre-commit-ignore-below---

r31788 [[BR]]
Fix a memory leak in ompi_osc_base_finalize()

cmr=v1.8.2:reviewer=rhc
Fixes #4624: Move r31753 to v1.8 branch (Fix the add_proc issue identified)

---svn-pre-commit-ignore-below---

r31753 [[BR]]
Fix the add_proc issue identified by Jeff: the TCP BTL now discard a
peer proc without TCP support instead of completely dropping TCP support for the entire job.

cmr=v1.8.2:reviewer=jsquyres
Fixes #4630: Move r31766 to v1.8 branch (comm: fix communicator subsystem leaks)

---svn-pre-commit-ignore-below---

r31766 [[BR]]
comm: fix communicator subsystem leaks

This commit fixes two leaks:

 - We never destructed the attributes on MPI_COMM_WORLD. All other
   communicators that have attributes are released through
   ompi_comm_free which does the attribute destruction. For
   MPI_COMM_WORLD this is now done before the destructor is called.

 - Add missing OBJ_RELEASE for ompi_comm_f_to_c_table.

cmr=v1.8.2:reviewer=jsquyres
Fixes #4631: Move r31767 to v1.8 branch (allocator/bucket: free all memory associated)

---svn-pre-commit-ignore-below---

r31767 [[BR]]
allocator/bucket: free all memory associated with a bucket allocator
when it is finalized.

Fixes a leak identified by valgrind.

cmr=v1.8.2:reviewer=jsquyres
Fixes #4632: Move r31768 to v1.8 branch (pml/ob1: add missing OBJ_DESTRUCT)

---svn-pre-commit-ignore-below---

r31768 [[BR]]
pml/ob1: add missing OBJ_DESTRUCT

An OBJ_DESTRUCT was missing for mca_pml_ob1.send_ranges causing a
memory leak. Identified by valgrind.

cmr=v1.8.2:reviewer=jsquyres
Fixes #4639: Move r31778, r31784 to v1.8 branch (Add missing include.)

---svn-pre-commit-ignore-below---

r31778 [[BR]]
ompi: fix various small leaks

This commit fixes three leaks:

 - bml/r2: fix leak of del_procs in mca_bml_r2_del_procs

 - Release the modex data in btl/scif, btl/ugni, and btl/vader

 - ompi_mpi_finalize: close the allocator framework

cmr=v1.8.2:reviewer=jsquyres

r31784 [[BR]]
Add missing include.

cmr=v1.8.2:ticket=#4639
Fixes #4644: Move r31783 to v1.8 branch (btl/vader: fix del_procs bug exposed)

---svn-pre-commit-ignore-below---

r31783 [[BR]]
btl/vader: fix del_procs bug exposed by the fact we now actually call
del_procs

cmr=v1.8.2:reviewer=jsquyres