Skip to content

Commit

Permalink
Merge pull request #2563 from garlick/plug_future_leak
Browse files Browse the repository at this point in the history
bindings/python and libev:  work around future leak
  • Loading branch information
grondo authored Dec 2, 2019
2 parents a005644 + 011e9ea commit 8b3476e
Show file tree
Hide file tree
Showing 13 changed files with 856 additions and 100 deletions.
10 changes: 8 additions & 2 deletions src/bindings/python/flux/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def submit_get_id(future):

def submit(flux_handle, jobspec, priority=lib.FLUX_JOB_PRIORITY_DEFAULT, flags=0):
future = submit_async(flux_handle, jobspec, priority, flags)
return submit_get_id(future)
jid = submit_get_id(future)
# pylint: disable=protected-access
future.pimpl._clear()
return jid


def wait_async(flux_handle, jobid=lib.FLUX_JOBID_ANY):
Expand All @@ -78,4 +81,7 @@ def wait_get_status(future):

def wait(flux_handle, jobid=lib.FLUX_JOBID_ANY):
future = wait_async(flux_handle, jobid)
return wait_get_status(future)
status = wait_get_status(future)
# pylint: disable=protected-access
future.pimpl._clear()
return status
8 changes: 4 additions & 4 deletions src/bindings/python/flux/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def __getattr__(self, name):
setattr(self, name, new_method)
return new_method

def __clear(self):
def _clear(self):
# avoid recursion
if hasattr(self, "_handle") and self._handle is not None:
handle = self._handle
Expand Down Expand Up @@ -354,14 +354,14 @@ def handle(self, h):
)
)
if self._handle is not None:
self.__clear()
self._clear()
self._handle = h

def __del__(self):
self.__clear()
self._clear()

def __enter__(self):
return self

def __exit__(self, type_arg, value, unused):
self.__clear()
self._clear()
7 changes: 6 additions & 1 deletion src/common/libev/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ libev_la_SOURCES = \
ev_vars.h \
ev_wrap.h

EXTRA_DIST = ev_select.c ev_poll.c ev_epoll.c libev.m4
EXTRA_DIST = \
ev_select.c \
ev_poll.c \
ev_epoll.c \
ev_linuxaio.c \
libev.m4
Loading

0 comments on commit 8b3476e

Please sign in to comment.