[issue33088] Cannot pass a SyncManager proxy to a multiprocessing subprocess on Windows

2018-03-16 Thread Jeff DuMonthier

New submission from Jeff DuMonthier <jeffrey.j.dumonth...@nasa.gov>:

The following simple example code creates a started SyncManager and passes it 
as an argument to a subprocess started with multiprocessing.Process().  It 
works on Linux and Mac OS but fails on Windows.

import multiprocessing as mp

def subProcFn(m1):
pass

if __name__ == "__main__":

__spec__ = None

m1 = mp.Manager()

p1 = mp.Process(target=subProcFn, args=(m1,))
p1.start()
p1.join()

This is the traceback in Spyder:

runfile('D:/ManagerBug.py', wdir='D:')
Traceback (most recent call last):

  File "", line 1, in 
runfile('D:/ManagerBug.py', wdir='D:')

  File "...\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", 
line 705, in runfile
execfile(filename, namespace)

  File "...\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", 
line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/ManagerBug.py", line 22, in 
p1.start()

  File "...\anaconda3\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)

  File "...\anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)

  File "...\anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)

  File "...\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in 
__init__
reduction.dump(process_obj, to_child)

  File "...\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)

TypeError: can't pickle weakref objects

--
components: Windows
messages: 313964
nosy: jjdmon, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Cannot pass a SyncManager proxy to a multiprocessing subprocess on 
Windows
type: behavior
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33088>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2017-05-03 Thread Jeff DuMonthier

New submission from Jeff DuMonthier:

In multiprocessing, attempting to add a Queue proxy to a dict or Namespace 
proxy (all returned by the same SyncManager) raises an exception indicating a 
keyword argument 'manager_owned=True' has been passed to the function 
AutoProxy() but is not an argument of that function.

In lib/python3.6/multiprocessing/managers.py, in function RebuildProxy(), line 
873: "kwds['manager_owned'] = True" adds this argument to a keyword argument 
dictionary.  This function calls AutoProxy which has an argument list defined 
on lines 909-910 as:
def AutoProxy(token, serializer, manager=None, authkey=None,
  exposed=None, incref=True):
This raises an exception because there is no manager_owned argument defined.  I 
added "manager_owned=False" as a keyword argument to AutoProxy which seems to 
have fixed the problem.  There is no exception and I am able to pass Queue 
proxies through dict and Namespace proxies to other processes and use them.  I 
don't know the purpose of that argument though or if the AutoProxy function 
should actually use it for something.  My fix allows but ignores it.

--
components: Library (Lib)
messages: 292889
nosy: jjdmon
priority: normal
severity: normal
status: open
title: Adding a SyncManager Queue proxy to a SyncManager dict or Namespace 
proxy raises an exception
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30256>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com