Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Lib/multiprocessing/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,20 +856,21 @@ def _incref(self):
dispatch(conn, None, 'incref', (self._id,))
util.debug('INCREF %r', self._token.id)

self._idset.add(self._id)
refid = f'{self._id}.{id(self)}'
self._idset.add(refid)

state = self._manager and self._manager._state

self._close = util.Finalize(
self, BaseProxy._decref,
args=(self._token, self._authkey, state,
args=(self._token, refid, self._authkey, state,
self._tls, self._idset, self._Client),
exitpriority=10
)

@staticmethod
def _decref(token, authkey, state, tls, idset, _Client):
idset.discard(token.id)
def _decref(token, refid, authkey, state, tls, idset, _Client):
idset.discard(refid)

# check whether manager is still alive
if state is None or state.value == State.STARTED:
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ Larry Hastings
Tim Hatch
Zac Hatfield-Dodds
Shane Hathaway
Akinori Hattori
Michael Haubenwallner
Janko Hauser
Flavian Hautbois
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a race condition in :class:`multiprocessing.Pool`.
Loading